﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Web;
using MySql.Data.MySqlClient;

namespace PM.DataAccess
{
    public class PmData
    {
        private string sql = string.Empty;
        private string sCon = SqlHelper.MysqlHelper.connectionString;





        /*********************************************************************************************************************************************/
        /*********************************************************************************************************************************************/

        public bool Add_face_m_build(int p_Self_Community_Code, int p_Self_Layer, int p_Up_Build_Code, string p_Build_Name,
                                         string p_Build_SimpleName, int p_Self_SortId, string p_Community_All_Code, string p_Self_All_Code,
                                         bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[1].Value = p_Self_Layer;
            parms[2] = new MySqlParameter("@in_Up_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Up_Build_Code;
            parms[3] = new MySqlParameter("@in_Build_Name", MySqlDbType.VarChar, 50); parms[3].Value = p_Build_Name;
            parms[4] = new MySqlParameter("@in_Build_SimpleName", MySqlDbType.VarChar, 50); parms[4].Value = p_Build_SimpleName;
            parms[5] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[5].Value = p_Self_SortId;
            parms[6] = new MySqlParameter("@in_Community_All_Code", MySqlDbType.VarChar, 255); parms[6].Value = p_Community_All_Code;
            parms[7] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_Self_All_Code;
            parms[8] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[8].Value = p_MyStatus;

            parms[9] = new MySqlParameter("@New_Self_Build_Code", MySqlDbType.Int32);
            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[9].Direction = ParameterDirection.Output;
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_build_Insert", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }





        public bool Modify_face_m_build(int p_Self_Build_Code, int p_Self_Community_Code, int p_Self_Layer, int p_Up_Build_Code, string p_Build_Name,
                                         string p_Build_SimpleName, int p_Self_SortId, string p_Community_All_Code, string p_Self_All_Code,
                                         bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Build_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[2].Value = p_Self_Layer;
            parms[3] = new MySqlParameter("@in_Up_Build_Code", MySqlDbType.Int32); parms[3].Value = p_Up_Build_Code;
            parms[4] = new MySqlParameter("@in_Build_Name", MySqlDbType.VarChar, 50); parms[4].Value = p_Build_Name;
            parms[5] = new MySqlParameter("@in_Build_SimpleName", MySqlDbType.VarChar, 50); parms[5].Value = p_Build_SimpleName;
            parms[6] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_Community_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_Community_All_Code;
            parms[8] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[8].Value = p_Self_All_Code;
            parms[9] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[9].Value = p_MyStatus;

            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_build_Modify", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_build(int p_Self_Build_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Build_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_build_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }

        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_coltd(int p_Self_Layer, int p_Up_CoLtd_Code, string p_CoLtd_Name,
                                        string p_CoLtd_SimpleName, int p_Self_Community_Code, int p_Self_SortId, string p_Self_All_Code, string p_Manager,
                                        bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[0].Value = p_Self_Layer;
            parms[1] = new MySqlParameter("@in_Up_CoLtd_Code", MySqlDbType.Int32); parms[1].Value = p_Up_CoLtd_Code;
            parms[2] = new MySqlParameter("@in_CoLtd_Name", MySqlDbType.VarChar, 50); parms[2].Value = p_CoLtd_Name;
            parms[3] = new MySqlParameter("@in_CoLtd_SimpleName", MySqlDbType.VarChar, 50); parms[3].Value = p_CoLtd_SimpleName;
            parms[4] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[4].Value = p_Self_Community_Code;
            parms[5] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[5].Value = p_Self_SortId;
            parms[6] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[6].Value = p_Self_All_Code;
            parms[7] = new MySqlParameter("@in_Manager", MySqlDbType.VarChar, 50); parms[7].Value = p_Manager;
            parms[8] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[8].Value = p_MyStatus;

            parms[9] = new MySqlParameter("@New_Self_CoLtd_Code", MySqlDbType.Int32);
            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[9].Direction = ParameterDirection.Output;
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_coltd_Insert", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_coltd(int p_Self_CoLtd_Code, int p_Self_Layer, int p_Up_CoLtd_Code, string p_CoLtd_Name,
                                         string p_CoLtd_SimpleName, int p_Self_Community_Code, int p_Self_SortId, string p_Self_All_Code, string p_Manager,
                                         bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[0].Value = p_Self_CoLtd_Code;
            parms[1] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[1].Value = p_Self_Layer;
            parms[2] = new MySqlParameter("@in_Up_CoLtd_Code", MySqlDbType.Int32); parms[2].Value = p_Up_CoLtd_Code;
            parms[3] = new MySqlParameter("@in_CoLtd_Name", MySqlDbType.VarChar, 50); parms[3].Value = p_CoLtd_Name;
            parms[4] = new MySqlParameter("@in_CoLtd_SimpleName", MySqlDbType.VarChar, 50); parms[4].Value = p_CoLtd_SimpleName;
            parms[5] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[5].Value = p_Self_Community_Code;
            parms[6] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_Self_All_Code;
            parms[8] = new MySqlParameter("@in_Manager", MySqlDbType.VarChar, 50); parms[8].Value = p_Manager;
            parms[9] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[9].Value = p_MyStatus;

            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_coltd_Modify", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_coltd(int p_Self_CoLtd_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[0].Value = p_Self_CoLtd_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_coltd_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/


        public bool Add_face_m_community(int p_Self_Layer, int p_Up_Community_Code, string p_Community_Name, string p_Community_SimpleName, int p_Self_CoLtd_Code, int p_Self_SortId,
                                        string p_Self_All_Code, bool p_MyStatus, string p_Urlsite)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[0].Value = p_Self_CoLtd_Code;
            parms[1] = new MySqlParameter("@in_Up_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Up_Community_Code;
            parms[2] = new MySqlParameter("@in_Community_Name", MySqlDbType.VarChar, 200); parms[2].Value = p_Community_Name;
            parms[3] = new MySqlParameter("@in_Community_SimpleName", MySqlDbType.VarChar, 50); parms[3].Value = p_Community_SimpleName;
            parms[4] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[4].Value = p_Self_CoLtd_Code;
            parms[5] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[5].Value = p_Self_SortId;
            parms[6] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[6].Value = p_Self_All_Code;
            parms[7] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[7].Value = p_MyStatus;
            parms[8] = new MySqlParameter("@in_Urlsite", MySqlDbType.VarChar); parms[8].Value = p_Urlsite;



            parms[9] = new MySqlParameter("@New_Self_Community_Code", MySqlDbType.Int32, 20);
            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[9].Direction = ParameterDirection.Output;
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;




            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_community_Insert", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool modify_face_m_community(int p_Self_Community_Code, int p_Self_Layer, int p_Up_Community_Code, string p_Community_Name, string p_Community_SimpleName, int p_Self_CoLtd_Code, int p_Self_SortId,
                                         string p_Self_All_Code, bool p_MyStatus, string p_Urlsite)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[1].Value = p_Self_CoLtd_Code;
            parms[2] = new MySqlParameter("@in_Up_Community_Code", MySqlDbType.Int32); parms[2].Value = p_Up_Community_Code;
            parms[3] = new MySqlParameter("@in_Community_Name", MySqlDbType.VarChar, 200); parms[3].Value = p_Community_Name;
            parms[4] = new MySqlParameter("@in_Community_SimpleName", MySqlDbType.VarChar, 50); parms[4].Value = p_Community_SimpleName;
            parms[5] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[5].Value = p_Self_CoLtd_Code;
            parms[6] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_Self_All_Code;
            parms[8] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[8].Value = p_MyStatus;
            parms[9] = new MySqlParameter("@in_Urlsite", MySqlDbType.VarChar); parms[9].Value = p_Urlsite;

            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_community_Modify", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_community(int p_Self_Community_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_community_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/



        public bool Add_face_m_complaints(int p_Clts_No, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name,
                                        string p_U_RepName, DateTime p_U_Rep_Date, string p_U_Rep_HomeTel, string p_U_Rep_Way, string p_U_Rep_Type,
                                        string p_U_Rep_Level, string p_U_Rep_Projects, string p_U_Rep_Key_Word, string p_U_Rep_Rmk1, string p_U_Rep_Something, bool p_U_Rep_Sms_Falg,
                                        string p_U_Rep_Dept, string p_U_Rep_RcdName, DateTime p_U_Rep_RcdDate, string p_V_Solve_Dept, string p_V_Solve_Name, DateTime p_V_Solve_Date,
                                        string p_V_V_Solve_Rmk2, string p_V_Solve_Something, string p_V_Solve_State, string p_V_Solve_Reult_Man, string p_V_Solve_RcdName,
                                        DateTime p_V_Solve_RcdDate, string p_W_Res_Name, DateTime p_W_Res_Date, string p_W_Res_Rmk3, string p_W_Res_Something, string p_W_Res_State,
                                        string p_W_Res_RcdName, DateTime p_W_Res_RcdDate, bool p_Clts_End_Flag)
        {
            MySqlParameter[] parms = new MySqlParameter[40];
            parms[0] = new MySqlParameter("@in_Clts_No", MySqlDbType.Int32); parms[0].Value = p_Clts_No;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Name;
            parms[6] = new MySqlParameter("@in_U_RepName", MySqlDbType.VarChar, 20); parms[6].Value = p_U_RepName;
            parms[7] = new MySqlParameter("@in_U_Rep_Date", MySqlDbType.Date); parms[7].Value = p_U_Rep_Date;
            parms[8] = new MySqlParameter("@in_U_Rep_HomeTel", MySqlDbType.VarChar, 20); parms[8].Value = p_U_Rep_Date;
            parms[9] = new MySqlParameter("@in_U_Rep_Way", MySqlDbType.VarChar, 20); parms[9].Value = p_U_Rep_HomeTel;
            parms[10] = new MySqlParameter("@in_U_Rep_Type", MySqlDbType.VarChar, 20); parms[10].Value = p_U_Rep_Type;
            parms[11] = new MySqlParameter("@in_U_Rep_Level", MySqlDbType.VarChar, 20); parms[11].Value = p_U_Rep_Level;
            parms[12] = new MySqlParameter("@in_U_Rep_Projects", MySqlDbType.VarChar, 20); parms[12].Value = p_U_Rep_Projects;
            parms[13] = new MySqlParameter("@in_U_Rep_Key_Word", MySqlDbType.VarChar, 20); parms[13].Value = p_U_Rep_Key_Word;
            parms[14] = new MySqlParameter("@in_U_Rep_Rmk1", MySqlDbType.VarChar, 100); parms[14].Value = p_U_Rep_Rmk1;
            parms[15] = new MySqlParameter("@in_U_Rep_Something", MySqlDbType.Text); parms[15].Value = p_U_Rep_Something;
            parms[16] = new MySqlParameter("@in_U_Rep_Sms_Falg", MySqlDbType.Bit); parms[16].Value = p_U_Rep_Sms_Falg;
            parms[17] = new MySqlParameter("@in_U_Rep_Dept", MySqlDbType.VarChar, 20); parms[17].Value = p_U_Rep_Dept;
            parms[18] = new MySqlParameter("@in_U_Rep_RcdName", MySqlDbType.VarChar, 20); parms[18].Value = p_U_Rep_RcdName;
            parms[19] = new MySqlParameter("@in_U_Rep_RcdDate", MySqlDbType.Date); parms[19].Value = p_U_Rep_RcdDate;
            parms[20] = new MySqlParameter("@in_V_Solve_Dept", MySqlDbType.VarChar, 20); parms[20].Value = p_V_Solve_Dept;
            parms[21] = new MySqlParameter("@in_V_Solve_Name", MySqlDbType.VarChar, 20); parms[21].Value = p_V_Solve_Name;
            parms[22] = new MySqlParameter("@in_V_Solve_Date", MySqlDbType.Date); parms[22].Value = p_V_Solve_Date;
            parms[23] = new MySqlParameter("@in_V_V_Solve_Rmk2", MySqlDbType.VarChar, 100); parms[23].Value = p_V_V_Solve_Rmk2;
            parms[24] = new MySqlParameter("@in_V_Solve_Something", MySqlDbType.Text); parms[24].Value = p_V_Solve_Something;
            parms[25] = new MySqlParameter("@in_V_Solve_State", MySqlDbType.VarChar, 20); parms[25].Value = p_V_Solve_State;
            parms[26] = new MySqlParameter("@in_V_Solve_Reult_Man", MySqlDbType.VarChar, 50); parms[26].Value = p_V_Solve_Reult_Man;
            parms[27] = new MySqlParameter("@in_V_Solve_RcdName", MySqlDbType.VarChar, 20); parms[27].Value = p_V_Solve_RcdName;
            parms[28] = new MySqlParameter("@in_V_Solve_RcdDate", MySqlDbType.Date); parms[28].Value = p_V_Solve_RcdDate;
            parms[29] = new MySqlParameter("@in_W_Res_Name", MySqlDbType.VarChar, 20); parms[29].Value = p_W_Res_Name;
            parms[30] = new MySqlParameter("@in_W_Res_Date", MySqlDbType.Date); parms[30].Value = p_W_Res_Date;
            parms[31] = new MySqlParameter("@in_W_Res_Rmk3", MySqlDbType.VarChar, 100); parms[31].Value = p_W_Res_Rmk3;
            parms[32] = new MySqlParameter("@in_W_Res_Something", MySqlDbType.Text); parms[32].Value = p_W_Res_Something;
            parms[33] = new MySqlParameter("@in_W_Res_State", MySqlDbType.VarChar, 20); parms[33].Value = p_W_Res_State;
            parms[34] = new MySqlParameter("@in_W_Res_RcdName", MySqlDbType.VarChar, 20); parms[34].Value = p_W_Res_RcdName;
            parms[35] = new MySqlParameter("@in_W_Res_RcdDate", MySqlDbType.Date); parms[35].Value = p_W_Res_RcdDate;
            parms[36] = new MySqlParameter("@in_Clts_End_Flag", MySqlDbType.Bit); parms[36].Value = p_Clts_End_Flag;

            parms[37] = new MySqlParameter("@New_Self_Comp_Code", MySqlDbType.Int32);
            parms[38] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[39] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[37].Direction = ParameterDirection.Output;
            parms[38].Direction = ParameterDirection.Output;
            parms[39].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_complaints_Insert", parms);
                return (int)parms[38].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Modify_face_m_complaints(int p_Comp_Code, int p_Clts_No, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name,
                                        string p_U_RepName, DateTime p_U_Rep_Date, string p_U_Rep_HomeTel, string p_U_Rep_Way, string p_U_Rep_Type,
                                        string p_U_Rep_Level, string p_U_Rep_Projects, string p_U_Rep_Key_Word, string p_U_Rep_Rmk1, string p_U_Rep_Something, bool p_U_Rep_Sms_Falg,
                                        string p_U_Rep_Dept, string p_U_Rep_RcdName, DateTime p_U_Rep_RcdDate, string p_V_Solve_Dept, string p_V_Solve_Name, DateTime p_V_Solve_Date,
                                        string p_V_V_Solve_Rmk2, string p_V_Solve_Something, string p_V_Solve_State, string p_V_Solve_Reult_Man, string p_V_Solve_RcdName,
                                        DateTime p_V_Solve_RcdDate, string p_W_Res_Name, DateTime p_W_Res_Date, string p_W_Res_Rmk3, string p_W_Res_Something, string p_W_Res_State,
                                        string p_W_Res_RcdName, DateTime p_W_Res_RcdDate, bool p_Clts_End_Flag)
        {
            MySqlParameter[] parms = new MySqlParameter[40];
            parms[0] = new MySqlParameter("@in_Comp_Code", MySqlDbType.Int32); parms[0].Value = p_Comp_Code;
            parms[1] = new MySqlParameter("@in_Clts_No", MySqlDbType.Int32); parms[1].Value = p_Clts_No;
            parms[2] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Community_Code;
            parms[3] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Build_Code;
            parms[4] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[4].Value = p_Self_Unit_Code;
            parms[5] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[5].Value = p_U_Self_No;
            parms[6] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[6].Value = p_Self_Name;
            parms[7] = new MySqlParameter("@in_U_RepName", MySqlDbType.VarChar, 20); parms[7].Value = p_U_RepName;
            parms[8] = new MySqlParameter("@in_U_Rep_Date", MySqlDbType.Date); parms[8].Value = p_U_Rep_Date;
            parms[9] = new MySqlParameter("@in_U_Rep_HomeTel", MySqlDbType.VarChar, 20); parms[9].Value = p_U_Rep_Date;
            parms[10] = new MySqlParameter("@in_U_Rep_Way", MySqlDbType.VarChar, 20); parms[10].Value = p_U_Rep_HomeTel;
            parms[11] = new MySqlParameter("@in_U_Rep_Type", MySqlDbType.VarChar, 20); parms[11].Value = p_U_Rep_Type;
            parms[12] = new MySqlParameter("@in_U_Rep_Level", MySqlDbType.VarChar, 20); parms[12].Value = p_U_Rep_Level;
            parms[13] = new MySqlParameter("@in_U_Rep_Projects", MySqlDbType.VarChar, 20); parms[13].Value = p_U_Rep_Projects;
            parms[14] = new MySqlParameter("@in_U_Rep_Key_Word", MySqlDbType.VarChar, 20); parms[14].Value = p_U_Rep_Key_Word;
            parms[15] = new MySqlParameter("@in_U_Rep_Rmk1", MySqlDbType.VarChar, 100); parms[15].Value = p_U_Rep_Rmk1;
            parms[16] = new MySqlParameter("@in_U_Rep_Something", MySqlDbType.Text); parms[16].Value = p_U_Rep_Something;
            parms[17] = new MySqlParameter("@in_U_Rep_Sms_Falg", MySqlDbType.Bit); parms[17].Value = p_U_Rep_Sms_Falg;
            parms[18] = new MySqlParameter("@in_U_Rep_Dept", MySqlDbType.VarChar, 20); parms[18].Value = p_U_Rep_Dept;
            parms[19] = new MySqlParameter("@in_U_Rep_RcdName", MySqlDbType.VarChar, 20); parms[19].Value = p_U_Rep_RcdName;
            parms[20] = new MySqlParameter("@in_U_Rep_RcdDate", MySqlDbType.Date); parms[20].Value = p_U_Rep_RcdDate;
            parms[21] = new MySqlParameter("@in_V_Solve_Dept", MySqlDbType.VarChar, 20); parms[21].Value = p_V_Solve_Dept;
            parms[22] = new MySqlParameter("@in_V_Solve_Name", MySqlDbType.VarChar, 20); parms[22].Value = p_V_Solve_Name;
            parms[23] = new MySqlParameter("@in_V_Solve_Date", MySqlDbType.Date); parms[23].Value = p_V_Solve_Date;
            parms[24] = new MySqlParameter("@in_V_V_Solve_Rmk2", MySqlDbType.VarChar, 100); parms[24].Value = p_V_V_Solve_Rmk2;
            parms[25] = new MySqlParameter("@in_V_Solve_Something", MySqlDbType.Text); parms[25].Value = p_V_Solve_Something;
            parms[26] = new MySqlParameter("@in_V_Solve_State", MySqlDbType.VarChar, 20); parms[26].Value = p_V_Solve_State;
            parms[27] = new MySqlParameter("@in_V_Solve_Reult_Man", MySqlDbType.VarChar, 50); parms[27].Value = p_V_Solve_Reult_Man;
            parms[28] = new MySqlParameter("@in_V_Solve_RcdName", MySqlDbType.VarChar, 20); parms[28].Value = p_V_Solve_RcdName;
            parms[29] = new MySqlParameter("@in_V_Solve_RcdDate", MySqlDbType.Date); parms[29].Value = p_V_Solve_RcdDate;
            parms[30] = new MySqlParameter("@in_W_Res_Name", MySqlDbType.VarChar, 20); parms[30].Value = p_W_Res_Name;
            parms[31] = new MySqlParameter("@in_W_Res_Date", MySqlDbType.Date); parms[31].Value = p_W_Res_Date;
            parms[32] = new MySqlParameter("@in_W_Res_Rmk3", MySqlDbType.VarChar, 100); parms[32].Value = p_W_Res_Rmk3;
            parms[33] = new MySqlParameter("@in_W_Res_Something", MySqlDbType.Text); parms[33].Value = p_W_Res_Something;
            parms[34] = new MySqlParameter("@in_W_Res_State", MySqlDbType.VarChar, 20); parms[34].Value = p_W_Res_State;
            parms[35] = new MySqlParameter("@in_W_Res_RcdName", MySqlDbType.VarChar, 20); parms[35].Value = p_W_Res_RcdName;
            parms[36] = new MySqlParameter("@in_W_Res_RcdDate", MySqlDbType.Date); parms[36].Value = p_W_Res_RcdDate;
            parms[37] = new MySqlParameter("@in_Clts_End_Flag", MySqlDbType.Bit); parms[37].Value = p_Clts_End_Flag;

            parms[38] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[39] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[38].Direction = ParameterDirection.Output;
            parms[39].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_complaints_Modify", parms);
                return (int)parms[38].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Del_face_m_complaints(int p_Comp_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Comp_Code", MySqlDbType.Int32); parms[0].Value = p_Comp_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_community_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        /*----------------------------------------------------------------------------------------------------------------------------------*/
        public bool Add_face_m_dept(int p_Self_CoLtd_Code, int p_Self_Layer, int p_Up_Dep_Code, string p_Dep_Name, string p_Dep_SimpleName, int p_Self_SortId, string p_CoLtd_All_Code,
                       string p_Self_All_Code, string p_Manager, bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[13];
            parms[0] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[0].Value = p_Self_CoLtd_Code;
            parms[1] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[1].Value = p_Self_Layer;
            parms[2] = new MySqlParameter("@in_Up_Dep_Code", MySqlDbType.Int32); parms[2].Value = p_Up_Dep_Code;
            parms[3] = new MySqlParameter("@in_Dep_Name", MySqlDbType.VarChar, 50); parms[3].Value = p_Dep_Name;
            parms[4] = new MySqlParameter("@in_Dep_SimpleName", MySqlDbType.VarChar, 50); parms[4].Value = p_Dep_SimpleName;
            parms[5] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[5].Value = p_Self_SortId;
            parms[6] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[6].Value = p_CoLtd_All_Code;
            parms[7] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_Self_All_Code;
            parms[8] = new MySqlParameter("@in_Manager", MySqlDbType.VarChar, 20); parms[8].Value = p_Manager;
            parms[9] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[9].Value = p_MyStatus;

            parms[10] = new MySqlParameter("@New_Self_Dep_Code", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[12] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;
            parms[12].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_dept_Insert", parms);
                return (int)parms[11].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool modify_face_m_dept(int p_Self_Dep_Code, int p_Self_CoLtd_Code, int p_Self_Layer, int p_Up_Dep_Code, string p_Dep_Name, string p_Dep_SimpleName, int p_Self_SortId, string p_CoLtd_All_Code,
                       string p_Self_All_Code, string p_Manager, bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[13];
            parms[0] = new MySqlParameter("@in_Self_Dep_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Dep_Code;
            parms[1] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[1].Value = p_Self_CoLtd_Code;
            parms[2] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[2].Value = p_Self_Layer;
            parms[3] = new MySqlParameter("@in_Up_Dep_Code", MySqlDbType.Int32); parms[3].Value = p_Up_Dep_Code;
            parms[4] = new MySqlParameter("@in_Dep_Name", MySqlDbType.VarChar, 50); parms[4].Value = p_Dep_Name;
            parms[5] = new MySqlParameter("@in_Dep_SimpleName", MySqlDbType.VarChar, 50); parms[5].Value = p_Dep_SimpleName;
            parms[6] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_CoLtd_All_Code;
            parms[8] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[8].Value = p_Self_All_Code;
            parms[9] = new MySqlParameter("@in_Manager", MySqlDbType.VarChar, 20); parms[98].Value = p_Manager;
            parms[10] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[10].Value = p_MyStatus;

            parms[11] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[12] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[11].Direction = ParameterDirection.Output;
            parms[12].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_dept_Modify", parms);
                return (int)parms[11].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_dept(int p_Self_Dep_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_Dep_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Dep_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_dept_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        /*----------------------------------------------------------------------------------------------------------------------------------*/



        public bool Add_face_m_doc_book(int p_Self_CoLtd_Code, int p_Self_Dir_Code, int p_Self_Layer, int p_Up_Doc_Code, string p_Self_Doc_BookName, int p_Self_SortId,
                                         string p_CoLtd_All_Code, string p_Self_CoLtd_Name, string p_Dir_All_Code, string p_Self_Dir_Name, string p_Self_All_Code,
                                         bool p_ShareFlag, int p_Share_Role_Id, bool p_MyStatus, string p_Book_No, string p_Book_Ver, string p_Book_Type,
                                         string p_Book_Controls, string p_Book_Send_No, string p_Book_Writer, DateTime p_Book_Write_Date, string p_Book_Checked_Name,
                                         string p_Book_ModiFy_State, string p_Book_Approved_Name, DateTime p_Book_Approved_Date, string p_Last_User, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[30];
            parms[0] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[0].Value = p_Self_CoLtd_Code;
            parms[1] = new MySqlParameter("@in_Self_Dir_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Dir_Code;
            parms[2] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[2].Value = p_Self_Layer;
            parms[3] = new MySqlParameter("@in_Up_Doc_Code", MySqlDbType.Int32); parms[3].Value = p_Up_Doc_Code;
            parms[4] = new MySqlParameter("@in_Self_Doc_BookName", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_Doc_BookName;
            parms[5] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[5].Value = p_Self_SortId;
            parms[6] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[6].Value = p_CoLtd_All_Code;
            parms[7] = new MySqlParameter("@in_Self_CoLtd_Name", MySqlDbType.VarChar, 50); parms[7].Value = p_Self_CoLtd_Name;
            parms[8] = new MySqlParameter("@in_Dir_All_Code", MySqlDbType.VarChar, 255); parms[8].Value = p_Dir_All_Code;
            parms[9] = new MySqlParameter("@in_Self_Dir_Name", MySqlDbType.VarChar, 50); parms[9].Value = p_Self_Dir_Name;
            parms[10] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[10].Value = p_Self_All_Code;
            parms[11] = new MySqlParameter("@in_ShareFlag", MySqlDbType.Bit); parms[11].Value = p_ShareFlag;
            parms[12] = new MySqlParameter("@in_Share_Role_Id", MySqlDbType.Int32); parms[12].Value = p_Share_Role_Id;
            parms[13] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[13].Value = p_MyStatus;
            parms[14] = new MySqlParameter("@in_Book_No", MySqlDbType.VarChar, 50); parms[14].Value = p_Book_No;
            parms[15] = new MySqlParameter("@in_Book_Ver", MySqlDbType.VarChar, 20); parms[15].Value = p_Book_Ver;
            parms[16] = new MySqlParameter("@in_Book_Type", MySqlDbType.VarChar, 20); parms[16].Value = p_Book_Type;
            parms[17] = new MySqlParameter("@in_Book_Controls", MySqlDbType.VarChar, 20); parms[17].Value = p_Book_Controls;
            parms[18] = new MySqlParameter("@in_Book_Send_No", MySqlDbType.VarChar, 20); parms[18].Value = p_Book_Send_No;
            parms[19] = new MySqlParameter("@in_Book_Writer", MySqlDbType.VarChar, 20); parms[19].Value = p_Book_Writer;
            parms[20] = new MySqlParameter("@in_Book_Write_Date", MySqlDbType.Date); parms[20].Value = p_Book_Write_Date;
            parms[21] = new MySqlParameter("@in_Book_Checked_Name", MySqlDbType.VarChar, 20); parms[21].Value = p_Book_Checked_Name;
            parms[22] = new MySqlParameter("@in_Book_ModiFy_State", MySqlDbType.VarChar, 20); parms[22].Value = p_Book_ModiFy_State;
            parms[23] = new MySqlParameter("@in_Book_Approved_Name", MySqlDbType.VarChar, 20); parms[23].Value = p_Book_Approved_Name;
            parms[24] = new MySqlParameter("@in_Book_Approved_Date", MySqlDbType.Date); parms[24].Value = p_Book_Approved_Date;
            parms[25] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[25].Value = p_Last_User;
            parms[26] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.Date); parms[26].Value = p_Last_UpDate;

            parms[27] = new MySqlParameter("@New_Self_doc_Code", MySqlDbType.Int32);
            parms[28] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[29] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[27].Direction = ParameterDirection.Output;
            parms[28].Direction = ParameterDirection.Output;
            parms[29].Direction = ParameterDirection.Output;




            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_doc_book_Insert", parms);
                return (int)parms[28].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool modify_face_m_doc_book(int p_Self_Doc_Code, int p_Self_CoLtd_Code, int p_Self_Dir_Code, int p_Self_Layer, int p_Up_Doc_Code, string p_Self_Doc_BookName, int p_Self_SortId,
                                         string p_CoLtd_All_Code, string p_Self_CoLtd_Name, string p_Dir_All_Code, string p_Self_Dir_Name, string p_Self_All_Code,
                                         bool p_ShareFlag, int p_Share_Role_Id, bool p_MyStatus, string p_Book_No, string p_Book_Ver, string p_Book_Type,
                                         string p_Book_Controls, string p_Book_Send_No, string p_Book_Writer, DateTime p_Book_Write_Date, string p_Book_Checked_Name,
                                         string p_Book_ModiFy_State, string p_Book_Approved_Name, DateTime p_Book_Approved_Date, string p_Last_User, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[30];
            parms[0] = new MySqlParameter("@in_Self_Doc_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Doc_Code;
            parms[1] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[1].Value = p_Self_CoLtd_Code;
            parms[2] = new MySqlParameter("@in_Self_Dir_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Dir_Code;
            parms[3] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[3].Value = p_Self_Layer;
            parms[4] = new MySqlParameter("@in_Up_Doc_Code", MySqlDbType.Int32); parms[4].Value = p_Up_Doc_Code;
            parms[5] = new MySqlParameter("@in_Self_Doc_BookName", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Doc_BookName;
            parms[6] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_CoLtd_All_Code;
            parms[8] = new MySqlParameter("@in_Self_CoLtd_Name", MySqlDbType.VarChar, 50); parms[8].Value = p_Self_CoLtd_Name;
            parms[9] = new MySqlParameter("@in_Dir_All_Code", MySqlDbType.VarChar, 255); parms[9].Value = p_Dir_All_Code;
            parms[10] = new MySqlParameter("@in_Self_Dir_Name", MySqlDbType.VarChar, 50); parms[10].Value = p_Self_Dir_Name;
            parms[11] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[11].Value = p_Self_All_Code;
            parms[12] = new MySqlParameter("@in_ShareFlag", MySqlDbType.Bit); parms[12].Value = p_ShareFlag;
            parms[13] = new MySqlParameter("@in_Share_Role_Id", MySqlDbType.Int32); parms[13].Value = p_Share_Role_Id;
            parms[14] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[14].Value = p_MyStatus;
            parms[15] = new MySqlParameter("@in_Book_No", MySqlDbType.VarChar, 50); parms[15].Value = p_Book_No;
            parms[16] = new MySqlParameter("@in_Book_Ver", MySqlDbType.VarChar, 20); parms[16].Value = p_Book_Ver;
            parms[17] = new MySqlParameter("@in_Book_Type", MySqlDbType.VarChar, 20); parms[17].Value = p_Book_Type;
            parms[18] = new MySqlParameter("@in_Book_Controls", MySqlDbType.VarChar, 20); parms[18].Value = p_Book_Controls;
            parms[19] = new MySqlParameter("@in_Book_Send_No", MySqlDbType.VarChar, 20); parms[19].Value = p_Book_Send_No;
            parms[20] = new MySqlParameter("@in_Book_Writer", MySqlDbType.VarChar, 20); parms[20].Value = p_Book_Writer;
            parms[21] = new MySqlParameter("@in_Book_Write_Date", MySqlDbType.Date); parms[21].Value = p_Book_Write_Date;
            parms[22] = new MySqlParameter("@in_Book_Checked_Name", MySqlDbType.VarChar, 20); parms[22].Value = p_Book_Checked_Name;
            parms[23] = new MySqlParameter("@in_Book_ModiFy_State", MySqlDbType.VarChar, 20); parms[23].Value = p_Book_ModiFy_State;
            parms[24] = new MySqlParameter("@in_Book_Approved_Name", MySqlDbType.VarChar, 20); parms[24].Value = p_Book_Approved_Name;
            parms[25] = new MySqlParameter("@in_Book_Approved_Date", MySqlDbType.Date); parms[25].Value = p_Book_Approved_Date;
            parms[26] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[26].Value = p_Last_User;
            parms[27] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.Date); parms[27].Value = p_Last_UpDate;

            parms[28] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[29] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[28].Direction = ParameterDirection.Output;
            parms[29].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_doc_book_Modify", parms);
                return (int)parms[28].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_doc_book(int p_Self_Doc_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_Doc_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Doc_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_doc_book_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }





        /*----------------------------------------------------------------------------------------------------------------------------------*/



        public bool Add_face_m_doc_dir(int p_Self_CoLtd_Code, int p_Self_Layer, int p_Up_Dir_Code, string p_Dir_Name, string p_Dir_ChinaName,
                                       int p_Self_SortId, string p_CoLtd_All_Code, bool p_Share_Flag, int p_Share_Role_Id, string p_Self_All_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[13];
            parms[0] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[0].Value = p_Self_CoLtd_Code;
            parms[1] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[1].Value = p_Self_Layer;
            parms[2] = new MySqlParameter("@in_Up_Dir_Code", MySqlDbType.Int32); parms[2].Value = p_Up_Dir_Code;
            parms[3] = new MySqlParameter("@in_Dir_Name", MySqlDbType.VarChar, 100); parms[3].Value = p_Dir_Name;
            parms[4] = new MySqlParameter("@in_Dir_ChinaName", MySqlDbType.VarChar, 50); parms[4].Value = p_Dir_ChinaName;
            parms[5] = new MySqlParameter("@p_Self_SortId", MySqlDbType.Int32); parms[5].Value = p_Self_SortId;
            parms[6] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[6].Value = p_CoLtd_All_Code;
            parms[7] = new MySqlParameter("@in_Share_Flag", MySqlDbType.Bit); parms[7].Value = p_Share_Flag;
            parms[8] = new MySqlParameter("@in_Share_Role_Id", MySqlDbType.Int32); parms[8].Value = p_Share_Role_Id;
            parms[9] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[9].Value = p_Self_All_Code;

            parms[10] = new MySqlParameter("@New_Self_Dir_Code", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[12] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;
            parms[12].Direction = ParameterDirection.Output;




            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_doc_dir_Insert", parms);
                return (int)parms[11].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool modify_face_m_doc_dir(int p_Self_Dir_Code, int p_Self_CoLtd_Code, int p_Self_Layer, int p_Up_Dir_Code, string p_Dir_Name, string p_Dir_ChinaName,
                                       int p_Self_SortId, string p_CoLtd_All_Code, bool p_Share_Flag, int p_Share_Role_Id, string p_Self_All_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[13];
            parms[0] = new MySqlParameter("@in_Self_Dir_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Dir_Code;
            parms[1] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[1].Value = p_Self_CoLtd_Code;
            parms[2] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[2].Value = p_Self_Layer;
            parms[3] = new MySqlParameter("@in_Up_Dir_Code", MySqlDbType.Int32); parms[3].Value = p_Up_Dir_Code;
            parms[4] = new MySqlParameter("@in_Dir_Name", MySqlDbType.VarChar, 100); parms[4].Value = p_Dir_Name;
            parms[5] = new MySqlParameter("@in_Dir_ChinaName", MySqlDbType.VarChar, 50); parms[5].Value = p_Dir_ChinaName;
            parms[6] = new MySqlParameter("@p_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_CoLtd_All_Code;
            parms[8] = new MySqlParameter("@in_Share_Flag", MySqlDbType.Bit); parms[8].Value = p_Share_Flag;
            parms[9] = new MySqlParameter("@in_Share_Role_Id", MySqlDbType.Int32); parms[9].Value = p_Share_Role_Id;
            parms[10] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[10].Value = p_Self_All_Code;

            parms[11] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[12] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[11].Direction = ParameterDirection.Output;
            parms[12].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_doc_dir_Modify", parms);
                return (int)parms[11].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_doc_dir(int p_Self_Dir_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_Dir_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Dir_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_doc_dir_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_emp(int p_Self_CoLtd_Code, int p_Self_Dep_Code, int p_Self_Layer, int p_Up_Emp_Code, string p_Self_EmpName,
                                       int p_Self_SortId, string p_CoLtd_All_Code, string p_Self_CoLtd_Name, string p_Dep_All_Code, string p_Self_Dep_Name,
                                       string p_Self_All_Code, int p_RoleId, bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[16];
            parms[0] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[0].Value = p_Self_CoLtd_Code;
            parms[1] = new MySqlParameter("@in_Self_Dep_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Dep_Code;
            parms[2] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[2].Value = p_Self_Layer;
            parms[3] = new MySqlParameter("@in_Up_Emp_Code", MySqlDbType.Int32); parms[3].Value = p_Up_Emp_Code;
            parms[4] = new MySqlParameter("@in_Self_EmpName", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_EmpName;
            parms[5] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[5].Value = p_Self_SortId;
            parms[6] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[6].Value = p_CoLtd_All_Code;
            parms[7] = new MySqlParameter("@in_Self_CoLtd_Name", MySqlDbType.VarChar, 50); parms[7].Value = p_Self_CoLtd_Name;
            parms[8] = new MySqlParameter("@in_Dep_All_Code", MySqlDbType.VarChar, 255); parms[8].Value = p_Dep_All_Code;
            parms[9] = new MySqlParameter("@in_Self_Dep_Name", MySqlDbType.VarChar, 50); parms[9].Value = p_Self_Dep_Name;
            parms[10] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[10].Value = p_Self_All_Code;
            parms[11] = new MySqlParameter("@in_RoleId", MySqlDbType.Int32); parms[11].Value = p_RoleId;
            parms[12] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[12].Value = p_MyStatus;

            parms[13] = new MySqlParameter("@New_Self_Emp_Code", MySqlDbType.Int32);
            parms[14] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[15] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[13].Direction = ParameterDirection.Output;
            parms[14].Direction = ParameterDirection.Output;
            parms[15].Direction = ParameterDirection.Output;


            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_emp_Insert", parms);
                return (int)parms[14].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool modify_face_m_emp(int p_Self_Emp_Code, int p_Self_CoLtd_Code, int p_Self_Dep_Code, int p_Self_Layer, int p_Up_Emp_Code, string p_Self_EmpName,
                                       int p_Self_SortId, string p_CoLtd_All_Code, string p_Self_CoLtd_Name, string p_Dep_All_Code, string p_Self_Dep_Name,
                                       string p_Self_All_Code, int p_RoleId, bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[16];
            parms[0] = new MySqlParameter("@in_Self_Emp_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Emp_Code;
            parms[1] = new MySqlParameter("@in_Self_CoLtd_Code", MySqlDbType.Int32); parms[1].Value = p_Self_CoLtd_Code;
            parms[2] = new MySqlParameter("@in_Self_Dep_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Dep_Code;
            parms[3] = new MySqlParameter("@in_Self_Layer", MySqlDbType.Int16); parms[3].Value = p_Self_Layer;
            parms[4] = new MySqlParameter("@in_Up_Emp_Code", MySqlDbType.Int32); parms[4].Value = p_Up_Emp_Code;
            parms[5] = new MySqlParameter("@in_Self_EmpName", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_EmpName;
            parms[6] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_CoLtd_All_Code", MySqlDbType.VarChar, 255); parms[7].Value = p_CoLtd_All_Code;
            parms[8] = new MySqlParameter("@in_Self_CoLtd_Name", MySqlDbType.VarChar, 50); parms[8].Value = p_Self_CoLtd_Name;
            parms[9] = new MySqlParameter("@in_Dep_All_Code", MySqlDbType.VarChar, 255); parms[9].Value = p_Dep_All_Code;
            parms[10] = new MySqlParameter("@in_Self_Dep_Name", MySqlDbType.VarChar, 50); parms[10].Value = p_Self_Dep_Name;
            parms[11] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar, 255); parms[11].Value = p_Self_All_Code;
            parms[12] = new MySqlParameter("@in_RoleId", MySqlDbType.Int32); parms[12].Value = p_RoleId;
            parms[13] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[13].Value = p_MyStatus;

            parms[14] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[15] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[14].Direction = ParameterDirection.Output;
            parms[15].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_emp_Modify", parms);
                return (int)parms[14].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_emp(int p_Self_Emp_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_Emp_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Emp_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_emp_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }

        /*----------------------------------------------------------------------------------------------------------------------------------*/



        public bool Add_face_m_family(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                      string p_Self_Name, string p_Residents_Name, string p_Res_Type, string p_Res_Sex, string p_Res_Nation,
                                      string p_Res_Mamerry, string p_Res_Country, string p_Res_Province, string p_Res_CountyOrCity,
                                      string p_Res_Town, string p_Res_IDCard,
                                      DateTime p_Res_Birthday, string p_Res_Professional, string p_Res_Job, string p_Res_JobUnit,
                                      string p_Res_OffiTel, string p_Res_Mas_Relation, string p_Res_Addres, string p_Res_PostCode,
                                      string p_Res_MobilPhone, string p_Res_EPhone, string p_Res_Special, string p_Res_Interest,
                                      string p_Res_Besting, Byte p_Res_Photo,  /*这个类型不知道怎么设置*/
                                      string p_Res_CardNo, DateTime p_CardSetDate, DateTime p_CardCanUseDate, int p_CardTimes,
                                      string p_CardType, string p_Res_Deadline, string p_Last_User, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[40];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_Name;
            parms[5] = new MySqlParameter("@in_Residents_Name", MySqlDbType.VarChar, 20); parms[5].Value = p_Residents_Name;
            parms[6] = new MySqlParameter("@in_Res_Type", MySqlDbType.VarChar, 50); parms[6].Value = p_Res_Type;
            parms[7] = new MySqlParameter("@in_Res_Sex", MySqlDbType.VarChar, 2); parms[7].Value = p_Res_Sex;
            parms[8] = new MySqlParameter("@in_Res_Nation", MySqlDbType.VarChar, 20); parms[8].Value = p_Res_Nation;
            parms[9] = new MySqlParameter("@in_Res_Mamerry", MySqlDbType.VarChar, 10); parms[9].Value = p_Res_Mamerry;

            parms[10] = new MySqlParameter("@in_Res_Country", MySqlDbType.VarChar, 50); parms[10].Value = p_Res_Country;
            parms[11] = new MySqlParameter("@in_Res_Province", MySqlDbType.VarChar, 50); parms[11].Value = p_Res_Province;
            parms[12] = new MySqlParameter("@in_Res_CountyOrCity", MySqlDbType.VarChar, 50); parms[12].Value = p_Res_CountyOrCity;
            parms[13] = new MySqlParameter("@in_Res_Town", MySqlDbType.VarChar, 50); parms[13].Value = p_Res_Town;
            parms[14] = new MySqlParameter("@in_Res_IDCard", MySqlDbType.VarChar, 18); parms[14].Value = p_Res_IDCard;
            parms[15] = new MySqlParameter("@in_Res_Birthday", MySqlDbType.Date); parms[15].Value = p_Res_Birthday;
            parms[16] = new MySqlParameter("@in_Res_Professional", MySqlDbType.VarChar, 20); parms[16].Value = p_Res_Professional;
            parms[17] = new MySqlParameter("@in_Res_Job", MySqlDbType.VarChar, 20); parms[17].Value = p_Res_Job;
            parms[18] = new MySqlParameter("@in_Res_JobUnit", MySqlDbType.VarChar, 50); parms[18].Value = p_Res_JobUnit;
            parms[19] = new MySqlParameter("@in_Res_OffiTel", MySqlDbType.VarChar, 50); parms[19].Value = p_Res_OffiTel;


            parms[20] = new MySqlParameter("@in_Res_Mas_Relation", MySqlDbType.VarChar, 12); parms[20].Value = p_Res_Mas_Relation;
            parms[21] = new MySqlParameter("@in_Res_Addres", MySqlDbType.VarChar, 50); parms[21].Value = p_Res_Addres;
            parms[22] = new MySqlParameter("@in_Res_PostCode", MySqlDbType.VarChar, 6); parms[22].Value = p_Res_PostCode;
            parms[23] = new MySqlParameter("@in_Res_MobilPhone", MySqlDbType.VarChar, 12); parms[23].Value = p_Res_MobilPhone;
            parms[24] = new MySqlParameter("@in_Res_EPhone", MySqlDbType.VarChar, 50); parms[24].Value = p_Res_EPhone;
            parms[25] = new MySqlParameter("@in_Res_Special", MySqlDbType.VarChar, 100); parms[25].Value = p_Res_Special;
            parms[26] = new MySqlParameter("@in_Res_Interest", MySqlDbType.VarChar, 50); parms[26].Value = p_Res_Interest;
            parms[27] = new MySqlParameter("@in_Res_Besting", MySqlDbType.VarChar, 50); parms[27].Value = p_Res_Besting;
            parms[28] = new MySqlParameter("@in_Res_Photo", MySqlDbType.Blob); parms[28].Value = p_Res_Photo;
            parms[29] = new MySqlParameter("@in_Res_CardNo", MySqlDbType.VarChar, 10); parms[29].Value = p_Res_CardNo;

            parms[30] = new MySqlParameter("@in_CardSetDate", MySqlDbType.Date); parms[30].Value = p_CardSetDate;
            parms[31] = new MySqlParameter("@in_CardCanUseDate", MySqlDbType.Date); parms[31].Value = p_CardCanUseDate;
            parms[32] = new MySqlParameter("@in_CardTimes", MySqlDbType.Int32); parms[32].Value = p_CardTimes;
            parms[33] = new MySqlParameter("@in_CardType", MySqlDbType.VarChar, 20); parms[33].Value = p_CardType;
            parms[34] = new MySqlParameter("@in_Res_Deadline", MySqlDbType.VarChar, 10); parms[34].Value = p_Res_Deadline;
            parms[35] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[35].Value = p_Last_User;
            parms[36] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.Date); parms[36].Value = p_Last_UpDate;



            parms[37] = new MySqlParameter("@New_Fami_Code", MySqlDbType.Int32);
            parms[38] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[39] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[37].Direction = ParameterDirection.Output;
            parms[38].Direction = ParameterDirection.Output;
            parms[39].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_family_Insert", parms);
                return (int)parms[38].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_family(int p_Fami_Code, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                      string p_Self_Name, string p_Residents_Name, string p_Res_Type, string p_Res_Sex, string p_Res_Nation,
                                      string p_Res_Mamerry, string p_Res_Country, string p_Res_Province, string p_Res_CountyOrCity,
                                      string p_Res_Town, string p_Res_IDCard,
                                      DateTime p_Res_Birthday, string p_Res_Professional, string p_Res_Job, string p_Res_JobUnit,
                                      string p_Res_OffiTel, string p_Res_Mas_Relation, string p_Res_Addres, string p_Res_PostCode,
                                      string p_Res_MobilPhone, string p_Res_EPhone, string p_Res_Special, string p_Res_Interest,
                                      string p_Res_Besting, Byte p_Res_Photo,  /*这个类型不知道怎么设置*/
                                      string p_Res_CardNo, DateTime p_CardSetDate, DateTime p_CardCanUseDate, int p_CardTimes,
                                      string p_CardType, string p_Res_Deadline, string p_Last_User, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[40];
            parms[0] = new MySqlParameter("@in_Fami_Code", MySqlDbType.Int32); parms[0].Value = p_Fami_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Name;
            parms[6] = new MySqlParameter("@in_Residents_Name", MySqlDbType.VarChar, 20); parms[6].Value = p_Residents_Name;
            parms[7] = new MySqlParameter("@in_Res_Type", MySqlDbType.VarChar, 50); parms[7].Value = p_Res_Type;
            parms[8] = new MySqlParameter("@in_Res_Sex", MySqlDbType.VarChar, 2); parms[8].Value = p_Res_Sex;
            parms[9] = new MySqlParameter("@in_Res_Nation", MySqlDbType.VarChar, 20); parms[9].Value = p_Res_Nation;
            parms[10] = new MySqlParameter("@in_Res_Mamerry", MySqlDbType.VarChar, 10); parms[10].Value = p_Res_Mamerry;

            parms[11] = new MySqlParameter("@in_Res_Country", MySqlDbType.VarChar, 50); parms[11].Value = p_Res_Country;
            parms[12] = new MySqlParameter("@in_Res_Province", MySqlDbType.VarChar, 50); parms[12].Value = p_Res_Province;
            parms[13] = new MySqlParameter("@in_Res_CountyOrCity", MySqlDbType.VarChar, 50); parms[13].Value = p_Res_CountyOrCity;
            parms[14] = new MySqlParameter("@in_Res_Town", MySqlDbType.VarChar, 50); parms[14].Value = p_Res_Town;
            parms[15] = new MySqlParameter("@in_Res_IDCard", MySqlDbType.VarChar, 18); parms[15].Value = p_Res_IDCard;
            parms[16] = new MySqlParameter("@in_Res_Birthday", MySqlDbType.Date); parms[16].Value = p_Res_Birthday;
            parms[17] = new MySqlParameter("@in_Res_Professional", MySqlDbType.VarChar, 20); parms[17].Value = p_Res_Professional;
            parms[18] = new MySqlParameter("@in_Res_Job", MySqlDbType.VarChar, 20); parms[18].Value = p_Res_Job;
            parms[19] = new MySqlParameter("@in_Res_JobUnit", MySqlDbType.VarChar, 50); parms[19].Value = p_Res_JobUnit;
            parms[20] = new MySqlParameter("@in_Res_OffiTel", MySqlDbType.VarChar, 50); parms[20].Value = p_Res_OffiTel;


            parms[21] = new MySqlParameter("@in_Res_Mas_Relation", MySqlDbType.VarChar, 12); parms[21].Value = p_Res_Mas_Relation;
            parms[22] = new MySqlParameter("@in_Res_Addres", MySqlDbType.VarChar, 50); parms[22].Value = p_Res_Addres;
            parms[23] = new MySqlParameter("@in_Res_PostCode", MySqlDbType.VarChar, 6); parms[23].Value = p_Res_PostCode;
            parms[24] = new MySqlParameter("@in_Res_MobilPhone", MySqlDbType.VarChar, 12); parms[24].Value = p_Res_MobilPhone;
            parms[25] = new MySqlParameter("@in_Res_EPhone", MySqlDbType.VarChar, 50); parms[25].Value = p_Res_EPhone;
            parms[26] = new MySqlParameter("@in_Res_Special", MySqlDbType.VarChar, 100); parms[26].Value = p_Res_Special;
            parms[27] = new MySqlParameter("@in_Res_Interest", MySqlDbType.VarChar, 50); parms[27].Value = p_Res_Interest;
            parms[28] = new MySqlParameter("@in_Res_Besting", MySqlDbType.VarChar, 50); parms[28].Value = p_Res_Besting;
            parms[29] = new MySqlParameter("@in_Res_Photo", MySqlDbType.Blob); parms[29].Value = p_Res_Photo;
            parms[30] = new MySqlParameter("@in_Res_CardNo", MySqlDbType.VarChar, 10); parms[30].Value = p_Res_CardNo;

            parms[31] = new MySqlParameter("@in_CardSetDate", MySqlDbType.Date); parms[31].Value = p_CardSetDate;
            parms[32] = new MySqlParameter("@in_CardCanUseDate", MySqlDbType.Date); parms[32].Value = p_CardCanUseDate;
            parms[33] = new MySqlParameter("@in_CardTimes", MySqlDbType.Int32); parms[33].Value = p_CardTimes;
            parms[34] = new MySqlParameter("@in_CardType", MySqlDbType.VarChar, 20); parms[34].Value = p_CardType;
            parms[35] = new MySqlParameter("@in_Res_Deadline", MySqlDbType.VarChar, 10); parms[35].Value = p_Res_Deadline;
            parms[36] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[36].Value = p_Last_User;
            parms[37] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.Date); parms[37].Value = p_Last_UpDate;



            parms[38] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[39] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[38].Direction = ParameterDirection.Output;
            parms[39].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_family_Modify", parms);
                return (int)parms[38].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Del_face_m_family(int p_Fami_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Fami_Code", MySqlDbType.Int32); parms[0].Value = p_Fami_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_family_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/


        public bool Add_face_m_price_type(int p_Self_Community_Code, string p_Price_Name, string p_Price_Type, string p_MachineType, bool p_User_Define_Flag, string p_Price_Rule, DateTime p_Begin_Date, DateTime p_End_Date)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Price_Name", MySqlDbType.VarChar, 50); parms[1].Value = p_Price_Name;
            parms[2] = new MySqlParameter("@in_Price_Type", MySqlDbType.VarChar, 50); parms[2].Value = p_Price_Type;
            parms[3] = new MySqlParameter("@in_MachineType", MySqlDbType.VarChar, 10); parms[3].Value = p_MachineType;
            parms[4] = new MySqlParameter("@in_User_Define_Flag", MySqlDbType.Bit); parms[4].Value = p_User_Define_Flag;
            parms[5] = new MySqlParameter("@in_Price_Rule", MySqlDbType.VarChar, 20); parms[5].Value = p_Price_Rule;
            parms[6] = new MySqlParameter("@in_Users", MySqlDbType.Int32); parms[6].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            parms[7] = new MySqlParameter("@in_Begin_Date", MySqlDbType.Date); parms[7].Value = p_Begin_Date;
            parms[8] = new MySqlParameter("@in_End_Date", MySqlDbType.Date); parms[8].Value = p_End_Date;

            parms[9] = new MySqlParameter("@New_Price_Code", MySqlDbType.Int32);
            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[9].Direction = ParameterDirection.Output;
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_price_type_Insert", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }

        public bool Modify_face_m_price_type(int p_Price_Code, int p_Self_Community_Code, string p_Price_Name, string p_Price_Type, string p_MachineType,
                                 bool p_User_Define_Flag, string p_Price_Rule, DateTime p_Begin_Date, DateTime p_End_Date)
        {
            MySqlParameter[] parms = new MySqlParameter[12];
            parms[0] = new MySqlParameter("@in_Price_Code", MySqlDbType.Int32); parms[0].Value = p_Price_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Price_Name", MySqlDbType.VarChar, 50); parms[2].Value = p_Price_Name;
            parms[3] = new MySqlParameter("@in_Price_Type", MySqlDbType.VarChar, 50); parms[3].Value = p_Price_Type;
            parms[4] = new MySqlParameter("@in_MachineType", MySqlDbType.VarChar, 10); parms[4].Value = p_MachineType;
            parms[5] = new MySqlParameter("@in_User_Define_Flag", MySqlDbType.Bit); parms[5].Value = p_User_Define_Flag;
            parms[6] = new MySqlParameter("@in_Price_Rule", MySqlDbType.VarChar, 20); parms[6].Value = p_Price_Rule;
            parms[7] = new MySqlParameter("@in_Users", MySqlDbType.Int32); parms[7].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            parms[8] = new MySqlParameter("@in_Begin_Date", MySqlDbType.Date); parms[8].Value = p_Begin_Date;
            parms[9] = new MySqlParameter("@in_End_Date", MySqlDbType.Date); parms[9].Value = p_End_Date;

            parms[10] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[11] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[10].Direction = ParameterDirection.Output;
            parms[11].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_price_type_Modify", parms);
                return (int)parms[10].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Del_face_m_price_type(int p_Price_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Price_Code", MySqlDbType.Int32); parms[0].Value = p_Price_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_price_type_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_repair(int p_Clts_No, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                      string p_Self_Name, string p_U_RepName, DateTime p_U_Rep_Date, string p_U_Rep_HomeTel, string p_U_Rep_Way,

                                      string p_U_Rep_Type, string p_U_Rep_Level, string p_U_Rep_Projects, string p_U_Rep_Key_Word, string p_U_Rep_Rmk1,
                                      string p_U_Rep_Something, bool p_U_Rep_Sms_Falg, string p_U_Rep_Dept, string p_U_Rep_RcdName, DateTime p_U_Rep_RcdDate,

                                      string p_V_Solve_Dept, string p_V_Solve_Name, DateTime p_V_Solve_Date1, DateTime p_V_Solve_Date2, string p_V_Solve_Rmk2,
                                      string p_V_Solve_Something, string p_V_Solve_State, decimal p_V_Solve_C_Labor, bool p_V_Solve_C_Labor_Flag, decimal p_V_Solve_C_Materials,

                                      bool p_V_Solve_C_Materials_Flag, decimal p_V_Solve_CostPay, string p_V_Solve_C_PayType, string p_V_Solve_Reult_Man, string p_V_Solve_RcdName,
                                      DateTime p_V_Solve_RcdDate, string p_W_Res_Name, DateTime p_W_Res_Date, string p_W_Res_Rmk3, string p_W_Res_Something,

                                      string p_W_Res_State, string p_W_Res_RcdName, DateTime p_W_Res_RcdDate, bool p_Clts_End_Flag, string p_Clts_Charge_Or_InAccount)
        {
            MySqlParameter[] parms = new MySqlParameter[48];
            parms[0] = new MySqlParameter("@in_Clts_No", MySqlDbType.Int32); parms[0].Value = p_Clts_No;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Name;
            parms[6] = new MySqlParameter("@in_U_RepName", MySqlDbType.VarChar, 20); parms[6].Value = p_U_RepName;
            parms[7] = new MySqlParameter("@in_U_Rep_Date", MySqlDbType.Date); parms[7].Value = p_U_Rep_Date;
            parms[8] = new MySqlParameter("@in_U_Rep_HomeTel", MySqlDbType.VarChar, 20); parms[8].Value = p_U_Rep_HomeTel;
            parms[9] = new MySqlParameter("@in_U_Rep_Way", MySqlDbType.VarChar, 20); parms[9].Value = p_U_Rep_Way;

            parms[10] = new MySqlParameter("@in_U_Rep_Type", MySqlDbType.VarChar, 20); parms[10].Value = p_U_Rep_Type;
            parms[11] = new MySqlParameter("@in_U_Rep_Level", MySqlDbType.VarChar, 20); parms[11].Value = p_U_Rep_Level;
            parms[12] = new MySqlParameter("@in_U_Rep_Projects", MySqlDbType.VarChar, 20); parms[12].Value = p_U_Rep_Projects;
            parms[13] = new MySqlParameter("@in_U_Rep_Key_Word", MySqlDbType.VarChar, 20); parms[13].Value = p_U_Rep_Key_Word;
            parms[14] = new MySqlParameter("@in_U_Rep_Rmk1", MySqlDbType.VarChar, 100); parms[14].Value = p_U_Rep_Rmk1;
            parms[15] = new MySqlParameter("@in_U_Rep_Something", MySqlDbType.Text); parms[15].Value = p_U_Rep_Something;
            parms[16] = new MySqlParameter("@in_U_Rep_Sms_Falg", MySqlDbType.Bit); parms[16].Value = p_U_Rep_Sms_Falg;
            parms[17] = new MySqlParameter("@in_U_Rep_Dept", MySqlDbType.VarChar, 20); parms[17].Value = p_U_Rep_Dept;
            parms[18] = new MySqlParameter("@in_U_Rep_RcdName", MySqlDbType.VarChar, 20); parms[18].Value = p_U_Rep_RcdName;
            parms[19] = new MySqlParameter("@in_U_Rep_RcdDate", MySqlDbType.Date); parms[19].Value = p_U_Rep_RcdDate;


            parms[20] = new MySqlParameter("@in_V_Solve_Dept", MySqlDbType.VarChar, 20); parms[20].Value = p_V_Solve_Dept;
            parms[21] = new MySqlParameter("@in_V_Solve_Name", MySqlDbType.VarChar, 20); parms[21].Value = p_V_Solve_Name;
            parms[22] = new MySqlParameter("@in_V_Solve_Date1", MySqlDbType.Date); parms[22].Value = p_V_Solve_Date1;
            parms[23] = new MySqlParameter("@in_V_Solve_Date2", MySqlDbType.Date); parms[23].Value = p_V_Solve_Date2;
            parms[24] = new MySqlParameter("@in_V_Solve_Rmk2", MySqlDbType.VarChar, 100); parms[24].Value = p_V_Solve_Rmk2;
            parms[25] = new MySqlParameter("@in_V_Solve_Something", MySqlDbType.Text); parms[25].Value = p_V_Solve_Something;
            parms[26] = new MySqlParameter("@in_V_Solve_State", MySqlDbType.VarChar, 20); parms[26].Value = p_V_Solve_State;
            parms[27] = new MySqlParameter("@in_V_Solve_C_Labor", MySqlDbType.Decimal); parms[27].Value = p_V_Solve_C_Labor;
            parms[28] = new MySqlParameter("@in_V_Solve_C_Labor_Flag", MySqlDbType.Bit); parms[28].Value = p_V_Solve_C_Labor_Flag;
            parms[29] = new MySqlParameter("@in_V_Solve_C_Materials", MySqlDbType.Decimal); parms[29].Value = p_V_Solve_C_Materials;

            parms[30] = new MySqlParameter("@in_V_Solve_C_Materials_Flag", MySqlDbType.Bit); parms[30].Value = p_V_Solve_C_Materials_Flag;
            parms[31] = new MySqlParameter("@in_V_Solve_CostPay", MySqlDbType.Decimal); parms[31].Value = p_V_Solve_CostPay;
            parms[32] = new MySqlParameter("@in_V_Solve_C_PayType", MySqlDbType.VarChar, 50); parms[32].Value = p_V_Solve_C_PayType;
            parms[33] = new MySqlParameter("@in_V_Solve_Reult_Man", MySqlDbType.VarChar, 20); parms[33].Value = p_V_Solve_Reult_Man;
            parms[34] = new MySqlParameter("@in_V_Solve_RcdName", MySqlDbType.VarChar, 20); parms[34].Value = p_V_Solve_RcdName;
            parms[35] = new MySqlParameter("@in_V_Solve_RcdDate", MySqlDbType.Date); parms[35].Value = p_V_Solve_RcdDate;
            parms[36] = new MySqlParameter("@in_W_Res_Name", MySqlDbType.VarChar, 20); parms[36].Value = p_W_Res_Name;
            parms[37] = new MySqlParameter("@in_W_Res_Date", MySqlDbType.Date); parms[37].Value = p_W_Res_Date;
            parms[38] = new MySqlParameter("@in_W_Res_Rmk3", MySqlDbType.VarChar, 100); parms[38].Value = p_W_Res_Rmk3;
            parms[39] = new MySqlParameter("@in_W_Res_Something", MySqlDbType.Text); parms[39].Value = p_W_Res_Something;

            parms[40] = new MySqlParameter("@in_W_Res_State", MySqlDbType.VarChar, 20); parms[40].Value = p_W_Res_State;
            parms[41] = new MySqlParameter("@in_W_Res_RcdName", MySqlDbType.VarChar, 20); parms[41].Value = p_W_Res_RcdName;
            parms[42] = new MySqlParameter("@in_W_Res_RcdDate", MySqlDbType.Date); parms[42].Value = p_W_Res_RcdDate;
            parms[43] = new MySqlParameter("@in_Clts_End_Flag", MySqlDbType.Bit); parms[43].Value = p_Clts_End_Flag;
            parms[44] = new MySqlParameter("@in_Clts_Charge_Or_InAccount", MySqlDbType.VarChar, 20); parms[44].Value = p_Clts_Charge_Or_InAccount;

            parms[45] = new MySqlParameter("@New_Repa_Code", MySqlDbType.Int32);
            parms[46] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[47] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[45].Direction = ParameterDirection.Output;
            parms[46].Direction = ParameterDirection.Output;
            parms[47].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_repair_Insert", parms);
                return (int)parms[46].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_repair(int p_Repa_Code, int p_Clts_No, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                      string p_Self_Name, string p_U_RepName, DateTime p_U_Rep_Date, string p_U_Rep_HomeTel, string p_U_Rep_Way,

                                      string p_U_Rep_Type, string p_U_Rep_Level, string p_U_Rep_Projects, string p_U_Rep_Key_Word, string p_U_Rep_Rmk1,
                                      string p_U_Rep_Something, bool p_U_Rep_Sms_Falg, string p_U_Rep_Dept, string p_U_Rep_RcdName, DateTime p_U_Rep_RcdDate,

                                      string p_V_Solve_Dept, string p_V_Solve_Name, DateTime p_V_Solve_Date1, DateTime p_V_Solve_Date2, string p_V_Solve_Rmk2,
                                      string p_V_Solve_Something, string p_V_Solve_State, decimal p_V_Solve_C_Labor, bool p_V_Solve_C_Labor_Flag, decimal p_V_Solve_C_Materials,

                                      bool p_V_Solve_C_Materials_Flag, decimal p_V_Solve_CostPay, string p_V_Solve_C_PayType, string p_V_Solve_Reult_Man, string p_V_Solve_RcdName,
                                      DateTime p_V_Solve_RcdDate, string p_W_Res_Name, DateTime p_W_Res_Date, string p_W_Res_Rmk3, string p_W_Res_Something,

                                      string p_W_Res_State, string p_W_Res_RcdName, DateTime p_W_Res_RcdDate, bool p_Clts_End_Flag, string p_Clts_Charge_Or_InAccount)
        {
            MySqlParameter[] parms = new MySqlParameter[48];
            parms[0] = new MySqlParameter("@in_Repa_Code", MySqlDbType.Int32); parms[0].Value = p_Repa_Code;
            parms[1] = new MySqlParameter("@in_Clts_No", MySqlDbType.Int32); parms[1].Value = p_Clts_No;
            parms[2] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Community_Code;
            parms[3] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Build_Code;
            parms[4] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[4].Value = p_Self_Unit_Code;
            parms[5] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[5].Value = p_U_Self_No;
            parms[6] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[6].Value = p_Self_Name;
            parms[7] = new MySqlParameter("@in_U_RepName", MySqlDbType.VarChar, 20); parms[7].Value = p_U_RepName;
            parms[8] = new MySqlParameter("@in_U_Rep_Date", MySqlDbType.Date); parms[8].Value = p_U_Rep_Date;
            parms[9] = new MySqlParameter("@in_U_Rep_HomeTel", MySqlDbType.VarChar, 20); parms[9].Value = p_U_Rep_HomeTel;
            parms[10] = new MySqlParameter("@in_U_Rep_Way", MySqlDbType.VarChar, 20); parms[10].Value = p_U_Rep_Way;

            parms[11] = new MySqlParameter("@in_U_Rep_Type", MySqlDbType.VarChar, 20); parms[11].Value = p_U_Rep_Type;
            parms[12] = new MySqlParameter("@in_U_Rep_Level", MySqlDbType.VarChar, 20); parms[12].Value = p_U_Rep_Level;
            parms[13] = new MySqlParameter("@in_U_Rep_Projects", MySqlDbType.VarChar, 20); parms[13].Value = p_U_Rep_Projects;
            parms[14] = new MySqlParameter("@in_U_Rep_Key_Word", MySqlDbType.VarChar, 20); parms[14].Value = p_U_Rep_Key_Word;
            parms[15] = new MySqlParameter("@in_U_Rep_Rmk1", MySqlDbType.VarChar, 100); parms[15].Value = p_U_Rep_Rmk1;
            parms[16] = new MySqlParameter("@in_U_Rep_Something", MySqlDbType.Text); parms[16].Value = p_U_Rep_Something;
            parms[17] = new MySqlParameter("@in_U_Rep_Sms_Falg", MySqlDbType.Bit); parms[17].Value = p_U_Rep_Sms_Falg;
            parms[18] = new MySqlParameter("@in_U_Rep_Dept", MySqlDbType.VarChar, 20); parms[18].Value = p_U_Rep_Dept;
            parms[19] = new MySqlParameter("@in_U_Rep_RcdName", MySqlDbType.VarChar, 20); parms[19].Value = p_U_Rep_RcdName;
            parms[20] = new MySqlParameter("@in_U_Rep_RcdDate", MySqlDbType.Date); parms[20].Value = p_U_Rep_RcdDate;


            parms[21] = new MySqlParameter("@in_V_Solve_Dept", MySqlDbType.VarChar, 20); parms[21].Value = p_V_Solve_Dept;
            parms[22] = new MySqlParameter("@in_V_Solve_Name", MySqlDbType.VarChar, 20); parms[22].Value = p_V_Solve_Name;
            parms[23] = new MySqlParameter("@in_V_Solve_Date1", MySqlDbType.Date); parms[23].Value = p_V_Solve_Date1;
            parms[24] = new MySqlParameter("@in_V_Solve_Date2", MySqlDbType.Date); parms[24].Value = p_V_Solve_Date2;
            parms[25] = new MySqlParameter("@in_V_Solve_Rmk2", MySqlDbType.VarChar, 100); parms[25].Value = p_V_Solve_Rmk2;
            parms[26] = new MySqlParameter("@in_V_Solve_Something", MySqlDbType.Text); parms[26].Value = p_V_Solve_Something;
            parms[27] = new MySqlParameter("@in_V_Solve_State", MySqlDbType.VarChar, 20); parms[27].Value = p_V_Solve_State;
            parms[28] = new MySqlParameter("@in_V_Solve_C_Labor", MySqlDbType.Decimal); parms[28].Value = p_V_Solve_C_Labor;
            parms[29] = new MySqlParameter("@in_V_Solve_C_Labor_Flag", MySqlDbType.Bit); parms[29].Value = p_V_Solve_C_Labor_Flag;
            parms[30] = new MySqlParameter("@in_V_Solve_C_Materials", MySqlDbType.Decimal); parms[30].Value = p_V_Solve_C_Materials;

            parms[31] = new MySqlParameter("@in_V_Solve_C_Materials_Flag", MySqlDbType.Bit); parms[31].Value = p_V_Solve_C_Materials_Flag;
            parms[32] = new MySqlParameter("@in_V_Solve_CostPay", MySqlDbType.Decimal); parms[32].Value = p_V_Solve_CostPay;
            parms[33] = new MySqlParameter("@in_V_Solve_C_PayType", MySqlDbType.VarChar, 50); parms[33].Value = p_V_Solve_C_PayType;
            parms[34] = new MySqlParameter("@in_V_Solve_Reult_Man", MySqlDbType.VarChar, 20); parms[34].Value = p_V_Solve_Reult_Man;
            parms[35] = new MySqlParameter("@in_V_Solve_RcdName", MySqlDbType.VarChar, 20); parms[35].Value = p_V_Solve_RcdName;
            parms[36] = new MySqlParameter("@in_V_Solve_RcdDate", MySqlDbType.Date); parms[36].Value = p_V_Solve_RcdDate;
            parms[37] = new MySqlParameter("@in_W_Res_Name", MySqlDbType.VarChar, 20); parms[37].Value = p_W_Res_Name;
            parms[38] = new MySqlParameter("@in_W_Res_Date", MySqlDbType.Date); parms[38].Value = p_W_Res_Date;
            parms[39] = new MySqlParameter("@in_W_Res_Rmk3", MySqlDbType.VarChar, 100); parms[39].Value = p_W_Res_Rmk3;
            parms[40] = new MySqlParameter("@in_W_Res_Something", MySqlDbType.Text); parms[40].Value = p_W_Res_Something;

            parms[41] = new MySqlParameter("@in_W_Res_State", MySqlDbType.VarChar, 20); parms[41].Value = p_W_Res_State;
            parms[42] = new MySqlParameter("@in_W_Res_RcdName", MySqlDbType.VarChar, 20); parms[42].Value = p_W_Res_RcdName;
            parms[43] = new MySqlParameter("@in_W_Res_RcdDate", MySqlDbType.Date); parms[43].Value = p_W_Res_RcdDate;
            parms[44] = new MySqlParameter("@in_Clts_End_Flag", MySqlDbType.Bit); parms[44].Value = p_Clts_End_Flag;
            parms[45] = new MySqlParameter("@in_Clts_Charge_Or_InAccount", MySqlDbType.VarChar, 20); parms[45].Value = p_Clts_Charge_Or_InAccount;

            parms[46] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[47] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[46].Direction = ParameterDirection.Output;
            parms[47].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_repair_Modify", parms);
                return (int)parms[46].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Del_face_m_repair(int p_Repa_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Repa_Code", MySqlDbType.Int32); parms[0].Value = p_Repa_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_repair_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_stopview(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_StopArea,
                                        string p_StopName, string p_Self_Name, string p_U_OwnerName, string p_State, DateTime p_BeginUse,
                                        DateTime p_EndUse, DateTime p_PackDate, bool p_MFree, string p_Remark, bool p_StateFlag,
                                        DateTime p_PayDate, DateTime p_HTEnd, string p_UserName, DateTime p_LastUpDate, bool p_ShareFlag,
                                        decimal p_MLeasePrice, decimal p_ManagePrice)
        {
            MySqlParameter[] parms = new MySqlParameter[24];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@in_StopArea", MySqlDbType.VarChar, 50); parms[4].Value = p_StopArea;
            parms[5] = new MySqlParameter("@in_StopName", MySqlDbType.VarChar, 20); parms[5].Value = p_StopName;
            parms[6] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[6].Value = p_Self_Name;
            parms[7] = new MySqlParameter("@in_U_OwnerName", MySqlDbType.VarChar, 50); parms[7].Value = p_U_OwnerName;
            parms[8] = new MySqlParameter("@in_State", MySqlDbType.VarChar, 20); parms[8].Value = p_State;
            parms[9] = new MySqlParameter("@in_BeginUse", MySqlDbType.Date); parms[9].Value = p_BeginUse;

            parms[10] = new MySqlParameter("@in_EndUse", MySqlDbType.Date); parms[10].Value = p_EndUse;
            parms[11] = new MySqlParameter("@in_PackDate", MySqlDbType.Date); parms[11].Value = p_PackDate;
            parms[12] = new MySqlParameter("@in_MFree", MySqlDbType.Bit); parms[12].Value = p_MFree;
            parms[13] = new MySqlParameter("@in_Remark", MySqlDbType.VarChar, 50); parms[13].Value = p_Remark;
            parms[14] = new MySqlParameter("@in_StateFlag", MySqlDbType.Bit); parms[14].Value = p_StateFlag;
            parms[15] = new MySqlParameter("@in_PayDate", MySqlDbType.Date); parms[15].Value = p_PayDate;
            parms[16] = new MySqlParameter("@in_HTEnd", MySqlDbType.Date); parms[16].Value = p_HTEnd;
            parms[17] = new MySqlParameter("@in_UserName", MySqlDbType.VarChar, 20); parms[17].Value = p_UserName;
            parms[18] = new MySqlParameter("@in_LastUpDate", MySqlDbType.DateTime); parms[18].Value = p_LastUpDate;   /*datetime类型*/
            parms[19] = new MySqlParameter("@in_ShareFlag", MySqlDbType.Bit); parms[19].Value = p_ShareFlag;


            parms[20] = new MySqlParameter("@in_MLeasePrice", MySqlDbType.Decimal); parms[20].Value = p_MLeasePrice;
            parms[21] = new MySqlParameter("@in_ManagePrice", MySqlDbType.Decimal); parms[21].Value = p_ManagePrice;

            parms[22] = new MySqlParameter("@New_Stop_Code", MySqlDbType.Int32);
            parms[23] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[24] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[22].Direction = ParameterDirection.Output;
            parms[23].Direction = ParameterDirection.Output;
            parms[24].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_stopview_Insert", parms);
                return (int)parms[23].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_stopview(int p_Stop_Code, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_StopArea,
                                        string p_StopName, string p_Self_Name, string p_U_OwnerName, string p_State, DateTime p_BeginUse,
                                        DateTime p_EndUse, DateTime p_PackDate, bool p_MFree, string p_Remark, bool p_StateFlag,
                                        DateTime p_PayDate, DateTime p_HTEnd, string p_UserName, DateTime p_LastUpDate, bool p_ShareFlag,
                                        decimal p_MLeasePrice, decimal p_ManagePrice)
        {
            MySqlParameter[] parms = new MySqlParameter[24];
            parms[0] = new MySqlParameter("@in_Stop_Code", MySqlDbType.Int32); parms[0].Value = p_Stop_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_StopArea", MySqlDbType.VarChar, 50); parms[5].Value = p_StopArea;
            parms[6] = new MySqlParameter("@in_StopName", MySqlDbType.VarChar, 20); parms[6].Value = p_StopName;
            parms[7] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[7].Value = p_Self_Name;
            parms[8] = new MySqlParameter("@in_U_OwnerName", MySqlDbType.VarChar, 50); parms[8].Value = p_U_OwnerName;
            parms[9] = new MySqlParameter("@in_State", MySqlDbType.VarChar, 20); parms[9].Value = p_State;
            parms[10] = new MySqlParameter("@in_BeginUse", MySqlDbType.Date); parms[10].Value = p_BeginUse;

            parms[11] = new MySqlParameter("@in_EndUse", MySqlDbType.Date); parms[11].Value = p_EndUse;
            parms[12] = new MySqlParameter("@in_PackDate", MySqlDbType.Date); parms[12].Value = p_PackDate;
            parms[13] = new MySqlParameter("@in_MFree", MySqlDbType.Bit); parms[13].Value = p_MFree;
            parms[14] = new MySqlParameter("@in_Remark", MySqlDbType.VarChar, 50); parms[14].Value = p_Remark;
            parms[15] = new MySqlParameter("@in_StateFlag", MySqlDbType.Bit); parms[15].Value = p_StateFlag;
            parms[16] = new MySqlParameter("@in_PayDate", MySqlDbType.Date); parms[16].Value = p_PayDate;
            parms[17] = new MySqlParameter("@in_HTEnd", MySqlDbType.Date); parms[17].Value = p_HTEnd;
            parms[18] = new MySqlParameter("@in_UserName", MySqlDbType.VarChar, 20); parms[18].Value = p_UserName;
            parms[19] = new MySqlParameter("@in_LastUpDate", MySqlDbType.DateTime); parms[19].Value = p_LastUpDate;   /*datetime类型*/
            parms[20] = new MySqlParameter("@in_ShareFlag", MySqlDbType.Bit); parms[20].Value = p_ShareFlag;


            parms[21] = new MySqlParameter("@in_MLeasePrice", MySqlDbType.Decimal); parms[21].Value = p_MLeasePrice;
            parms[22] = new MySqlParameter("@in_ManagePrice", MySqlDbType.Decimal); parms[22].Value = p_ManagePrice;

            parms[23] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[24] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[23].Direction = ParameterDirection.Output;
            parms[24].Direction = ParameterDirection.Output;


            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_stopview_Modify", parms);
                return (int)parms[23].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Del_face_m_stopview(int p_Stop_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Stop_Code", MySqlDbType.Int32); parms[0].Value = p_Stop_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_stopview_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }







        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_base(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Level, string p_Self_Place, string p_Self_Name,
                                        string p_Self_SimpleName, int p_Self_SortId, string p_Community_All_Code, string p_Build_All_Code, string p_Self_All_Code,
                                        bool p_MyStatus, decimal p_All_Area, decimal p_In_Area, decimal p_Real_Area, decimal p_SalePrice,
                                        string p_Direction, string p_Struct, string p_Unit_Style, string p_UseFor, string p_Management_Depend)
        {
            MySqlParameter[] parms = new MySqlParameter[23];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Level", MySqlDbType.Int16); parms[2].Value = p_Self_Level;
            parms[3] = new MySqlParameter("@in_Self_Place", MySqlDbType.VarChar, 4); parms[3].Value = p_Self_Place;
            parms[4] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_Name;
            parms[5] = new MySqlParameter("@in_Self_SimpleName", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_SimpleName;
            parms[6] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[6].Value = p_Self_SortId;
            parms[7] = new MySqlParameter("@in_Community_All_Code", MySqlDbType.VarChar); parms[7].Value = p_Community_All_Code;
            parms[8] = new MySqlParameter("@in_Build_All_Code", MySqlDbType.VarChar); parms[8].Value = p_Build_All_Code;
            parms[9] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar); parms[9].Value = p_Self_All_Code;

            parms[10] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[10].Value = p_MyStatus;
            parms[11] = new MySqlParameter("@in_All_Area", MySqlDbType.Decimal); parms[11].Value = p_All_Area;
            parms[12] = new MySqlParameter("@in_In_Area", MySqlDbType.Decimal); parms[12].Value = p_In_Area;
            parms[13] = new MySqlParameter("@in_Real_Area", MySqlDbType.Decimal); parms[13].Value = p_Real_Area;
            parms[14] = new MySqlParameter("@in_SalePrice", MySqlDbType.Decimal); parms[14].Value = p_SalePrice;
            parms[15] = new MySqlParameter("@in_Direction", MySqlDbType.VarChar, 20); parms[15].Value = p_Direction;
            parms[16] = new MySqlParameter("@in_Struct", MySqlDbType.VarChar, 20); parms[16].Value = p_Struct;
            parms[17] = new MySqlParameter("@in_Unit_Style", MySqlDbType.VarChar, 20); parms[17].Value = p_Unit_Style;
            parms[18] = new MySqlParameter("@in_UseFor", MySqlDbType.VarChar, 20); parms[18].Value = p_UseFor;
            parms[19] = new MySqlParameter("@in_Management_Depend", MySqlDbType.VarChar, 20); parms[19].Value = p_Management_Depend;

            parms[20] = new MySqlParameter("@New_Self_Unit_Code", MySqlDbType.Int32);
            parms[21] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[22] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[20].Direction = ParameterDirection.Output;
            parms[21].Direction = ParameterDirection.Output;
            parms[22].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_base_Insert", parms);
                return (int)parms[21].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Modify_face_m_unit_base(int p_Self_Unit_Code, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Level, string p_Self_Place, string p_Self_Name,
                                               string p_Self_SimpleName, int p_Self_SortId, string p_Community_All_Code, string p_Build_All_Code, string p_Self_All_Code,
                                               bool p_MyStatus, decimal p_All_Area, decimal p_In_Area, decimal p_Real_Area, decimal p_SalePrice,
                                               string p_Direction, string p_Struct, string p_Unit_Style, string p_UseFor, string p_Management_Depend)
        {
            MySqlParameter[] parms = new MySqlParameter[23];
            parms[0] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Unit_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Level", MySqlDbType.Int16); parms[3].Value = p_Self_Level;
            parms[4] = new MySqlParameter("@in_Self_Place", MySqlDbType.VarChar, 4); parms[4].Value = p_Self_Place;
            parms[5] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Name;
            parms[6] = new MySqlParameter("@in_Self_SimpleName", MySqlDbType.VarChar, 50); parms[6].Value = p_Self_SimpleName;
            parms[7] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[7].Value = p_Self_SortId;
            parms[8] = new MySqlParameter("@in_Community_All_Code", MySqlDbType.VarChar); parms[8].Value = p_Community_All_Code;
            parms[9] = new MySqlParameter("@in_Build_All_Code", MySqlDbType.VarChar); parms[9].Value = p_Build_All_Code;
            parms[10] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar); parms[10].Value = p_Self_All_Code;

            parms[11] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[11].Value = p_MyStatus;
            parms[12] = new MySqlParameter("@in_All_Area", MySqlDbType.Decimal); parms[12].Value = p_All_Area;
            parms[13] = new MySqlParameter("@in_In_Area", MySqlDbType.Decimal); parms[13].Value = p_In_Area;
            parms[14] = new MySqlParameter("@in_Real_Area", MySqlDbType.Decimal); parms[14].Value = p_Real_Area;
            parms[15] = new MySqlParameter("@in_SalePrice", MySqlDbType.Decimal); parms[15].Value = p_SalePrice;
            parms[16] = new MySqlParameter("@in_Direction", MySqlDbType.VarChar, 20); parms[16].Value = p_Direction;
            parms[17] = new MySqlParameter("@in_Struct", MySqlDbType.VarChar, 20); parms[17].Value = p_Struct;
            parms[18] = new MySqlParameter("@in_Unit_Style", MySqlDbType.VarChar, 20); parms[18].Value = p_Unit_Style;
            parms[19] = new MySqlParameter("@in_UseFor", MySqlDbType.VarChar, 20); parms[19].Value = p_UseFor;
            parms[20] = new MySqlParameter("@in_Management_Depend", MySqlDbType.VarChar, 20); parms[20].Value = p_Management_Depend;

            parms[21] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[22] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[21].Direction = ParameterDirection.Output;
            parms[22].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_base_Modify", parms);
                return (int)parms[21].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_unit_base(int p_Self_Unit_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Unit_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_base_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }






        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_data(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, string p_U_Owner, int p_Self_Level,
                                         string p_Self_Place, string p_Self_Name, string p_Self_SimpleName, int p_Self_SortId, string p_Community_All_Code,
                                         string p_Build_All_Code, string p_Self_All_Code, bool p_MyStatus, decimal p_All_Area, decimal p_In_Area,
                                         decimal p_Real_Area, decimal p_SalePrice, string p_Direction, string p_Struct, string p_Unit_Style,
                                         string p_UseFor, string p_Management_Depend, string p_U_PactNo, string p_U_BookNo, DateTime? p_U_Pay_Date,
                                         bool p_U_Rec_OK, DateTime? p_U_Rec_Date, DateTime? p_U_Decorated_Date, DateTime? p_U_Living_Date, string p_U_Mobil,
                                         string p_U_Home_Tel, string p_U_Owner_ID, string p_U_Email, decimal p_U_Manage_Price, bool p_U_Sms_Need,
                                         bool p_U_Overdue_Flag, string p_FaceHomes_Id, string p_FaceHomes_Psw)
        {
            MySqlParameter[] parms = new MySqlParameter[41];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@in_U_Owner", MySqlDbType.VarChar, 50); parms[3].Value = p_U_Owner;
            parms[4] = new MySqlParameter("@in_Self_Level", MySqlDbType.Int16); parms[4].Value = p_Self_Level;
            parms[5] = new MySqlParameter("@in_Self_Place", MySqlDbType.VarChar, 4); parms[5].Value = p_Self_Place;
            parms[6] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[6].Value = p_Self_Name;
            parms[7] = new MySqlParameter("@in_Self_SimpleName", MySqlDbType.VarChar, 50); parms[7].Value = p_Self_SimpleName;
            parms[8] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[8].Value = p_Self_SortId;
            parms[9] = new MySqlParameter("@in_Community_All_Code", MySqlDbType.VarChar); parms[9].Value = p_Community_All_Code;

            parms[10] = new MySqlParameter("@in_Build_All_Code", MySqlDbType.VarChar); parms[10].Value = p_Build_All_Code;
            parms[11] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar); parms[11].Value = p_Self_All_Code;
            parms[12] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[12].Value = p_MyStatus;
            parms[13] = new MySqlParameter("@in_All_Area", MySqlDbType.Decimal); parms[13].Value = p_All_Area;
            parms[14] = new MySqlParameter("@in_In_Area", MySqlDbType.Decimal); parms[14].Value = p_In_Area;
            parms[15] = new MySqlParameter("@in_Real_Area", MySqlDbType.Decimal); parms[15].Value = p_Real_Area;
            parms[16] = new MySqlParameter("@in_SalePrice", MySqlDbType.Decimal); parms[16].Value = p_SalePrice;
            parms[17] = new MySqlParameter("@in_Direction", MySqlDbType.VarChar, 20); parms[17].Value = p_Direction;
            parms[18] = new MySqlParameter("@in_Struct", MySqlDbType.VarChar, 20); parms[18].Value = p_Struct;
            parms[19] = new MySqlParameter("@in_Unit_Style", MySqlDbType.VarChar, 20); parms[19].Value = p_Unit_Style;

            parms[20] = new MySqlParameter("@in_UseFor", MySqlDbType.VarChar, 20); parms[20].Value = p_UseFor;
            parms[21] = new MySqlParameter("@in_Management_Depend", MySqlDbType.VarChar, 20); parms[21].Value = p_Management_Depend;
            parms[22] = new MySqlParameter("@in_U_PactNo", MySqlDbType.VarChar, 50); parms[22].Value = p_U_PactNo;
            parms[23] = new MySqlParameter("@in_U_BookNo", MySqlDbType.VarChar, 50); parms[23].Value = p_U_BookNo;
            parms[24] = new MySqlParameter("@in_U_Pay_Date", MySqlDbType.Date); parms[24].Value = p_U_Pay_Date;
            parms[25] = new MySqlParameter("@in_U_Rec_OK", MySqlDbType.Bit); parms[25].Value = p_U_Rec_OK;
            parms[26] = new MySqlParameter("@in_U_Rec_Date", MySqlDbType.Date); parms[26].Value = p_U_Rec_Date;
            parms[27] = new MySqlParameter("@in_U_Decorated_Date", MySqlDbType.Date); parms[27].Value = p_U_Decorated_Date;
            parms[28] = new MySqlParameter("@in_U_Living_Date", MySqlDbType.Date); parms[28].Value = p_U_Living_Date;
            parms[29] = new MySqlParameter("@in_U_Mobil", MySqlDbType.VarChar, 12); parms[29].Value = p_U_Mobil;


            parms[30] = new MySqlParameter("@in_U_Home_Tel", MySqlDbType.VarChar, 20); parms[30].Value = p_U_Home_Tel;
            parms[31] = new MySqlParameter("@in_U_Owner_ID", MySqlDbType.VarChar, 20); parms[31].Value = p_U_Owner_ID;
            parms[32] = new MySqlParameter("@in_U_Email", MySqlDbType.VarChar, 60); parms[32].Value = p_U_Email;
            parms[33] = new MySqlParameter("@in_U_Manage_Price", MySqlDbType.Decimal); parms[33].Value = p_U_Manage_Price;
            parms[34] = new MySqlParameter("@in_U_Sms_Need", MySqlDbType.Bit); parms[34].Value = p_U_Sms_Need;
            parms[35] = new MySqlParameter("@in_U_Overdue_Flag", MySqlDbType.Bit); parms[35].Value = p_U_Overdue_Flag;
            parms[36] = new MySqlParameter("@in_FaceHomes_Id", MySqlDbType.VarChar, 50); parms[36].Value = p_FaceHomes_Id;
            parms[37] = new MySqlParameter("@in_FaceHomes_Psw", MySqlDbType.VarChar, 50); parms[37].Value = p_FaceHomes_Psw;


            parms[38] = new MySqlParameter("@New_User_Self_Code", MySqlDbType.Int32);
            parms[39] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[40] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[38].Direction = ParameterDirection.Output;
            parms[39].Direction = ParameterDirection.Output;
            parms[40].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_data_Insert", parms);
                return (int)parms[39].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Modify_face_m_unit_data(int p_User_Self_Code, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, string p_U_Owner, int p_Self_Level,
                                                string p_Self_Place, string p_Self_Name, string p_Self_SimpleName, int p_Self_SortId, string p_Community_All_Code,
                                                string p_Build_All_Code, string p_Self_All_Code, bool p_MyStatus, decimal p_All_Area, decimal p_In_Area,
                                                decimal p_Real_Area, decimal p_SalePrice, string p_Direction, string p_Struct, string p_Unit_Style,
                                                string p_UseFor, string p_Management_Depend, string p_U_PactNo, string p_U_BookNo, DateTime? p_U_Pay_Date,
                                                bool p_U_Rec_OK, DateTime? p_U_Rec_Date, DateTime? p_U_Decorated_Date, DateTime? p_U_Living_Date, string p_U_Mobil,
                                                string p_U_Home_Tel, string p_U_Owner_ID, string p_U_Email, decimal p_U_Manage_Price, bool p_U_Sms_Need,
                                                bool p_U_Overdue_Flag, string p_FaceHomes_Id, string p_FaceHomes_Psw)
        {
            MySqlParameter[] parms = new MySqlParameter[41];
            parms[0] = new MySqlParameter("@in_User_Self_Code", MySqlDbType.Int32); parms[0].Value = p_User_Self_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Owner", MySqlDbType.VarChar, 50); parms[4].Value = p_U_Owner;
            parms[5] = new MySqlParameter("@in_Self_Level", MySqlDbType.Int16); parms[5].Value = p_Self_Level;
            parms[6] = new MySqlParameter("@in_Self_Place", MySqlDbType.VarChar, 4); parms[6].Value = p_Self_Place;
            parms[7] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[7].Value = p_Self_Name;
            parms[8] = new MySqlParameter("@in_Self_SimpleName", MySqlDbType.VarChar, 50); parms[8].Value = p_Self_SimpleName;
            parms[9] = new MySqlParameter("@in_Self_SortId", MySqlDbType.Int32); parms[9].Value = p_Self_SortId;
            parms[10] = new MySqlParameter("@in_Community_All_Code", MySqlDbType.VarChar); parms[10].Value = p_Community_All_Code;

            parms[11] = new MySqlParameter("@in_Build_All_Code", MySqlDbType.VarChar); parms[11].Value = p_Build_All_Code;
            parms[12] = new MySqlParameter("@in_Self_All_Code", MySqlDbType.VarChar); parms[12].Value = p_Self_All_Code;
            parms[13] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[13].Value = p_MyStatus;
            parms[14] = new MySqlParameter("@in_All_Area", MySqlDbType.Decimal); parms[14].Value = p_All_Area;
            parms[15] = new MySqlParameter("@in_In_Area", MySqlDbType.Decimal); parms[15].Value = p_In_Area;
            parms[16] = new MySqlParameter("@in_Real_Area", MySqlDbType.Decimal); parms[16].Value = p_Real_Area;
            parms[17] = new MySqlParameter("@in_SalePrice", MySqlDbType.Decimal); parms[17].Value = p_SalePrice;
            parms[18] = new MySqlParameter("@in_Direction", MySqlDbType.VarChar, 20); parms[18].Value = p_Direction;
            parms[19] = new MySqlParameter("@in_Struct", MySqlDbType.VarChar, 20); parms[19].Value = p_Struct;
            parms[20] = new MySqlParameter("@in_Unit_Style", MySqlDbType.VarChar, 20); parms[20].Value = p_Unit_Style;

            parms[21] = new MySqlParameter("@in_UseFor", MySqlDbType.VarChar, 20); parms[21].Value = p_UseFor;
            parms[22] = new MySqlParameter("@in_Management_Depend", MySqlDbType.VarChar, 20); parms[22].Value = p_Management_Depend;
            parms[23] = new MySqlParameter("@in_U_PactNo", MySqlDbType.VarChar, 50); parms[23].Value = p_U_PactNo;
            parms[24] = new MySqlParameter("@in_U_BookNo", MySqlDbType.VarChar, 50); parms[24].Value = p_U_BookNo;
            parms[25] = new MySqlParameter("@in_U_Pay_Date", MySqlDbType.Date); parms[25].Value = p_U_Pay_Date;
            parms[26] = new MySqlParameter("@in_U_Rec_OK", MySqlDbType.Bit); parms[26].Value = p_U_Rec_OK;
            parms[27] = new MySqlParameter("@in_U_Rec_Date", MySqlDbType.Date); parms[27].Value = p_U_Rec_Date;
            parms[28] = new MySqlParameter("@in_U_Decorated_Date", MySqlDbType.Date); parms[28].Value = p_U_Decorated_Date;
            parms[29] = new MySqlParameter("@in_U_Living_Date", MySqlDbType.Date); parms[29].Value = p_U_Living_Date;
            parms[30] = new MySqlParameter("@in_U_Mobil", MySqlDbType.VarChar, 12); parms[30].Value = p_U_Mobil;


            parms[31] = new MySqlParameter("@in_U_Home_Tel", MySqlDbType.VarChar, 20); parms[31].Value = p_U_Home_Tel;
            parms[32] = new MySqlParameter("@in_U_Owner_ID", MySqlDbType.VarChar, 20); parms[32].Value = p_U_Owner_ID;
            parms[33] = new MySqlParameter("@in_U_Email", MySqlDbType.VarChar, 60); parms[33].Value = p_U_Email;
            parms[34] = new MySqlParameter("@in_U_Manage_Price", MySqlDbType.Decimal); parms[34].Value = p_U_Manage_Price;
            parms[35] = new MySqlParameter("@in_U_Sms_Need", MySqlDbType.Bit); parms[35].Value = p_U_Sms_Need;
            parms[36] = new MySqlParameter("@in_U_Overdue_Flag", MySqlDbType.Bit); parms[36].Value = p_U_Overdue_Flag;
            parms[37] = new MySqlParameter("@in_FaceHomes_Id", MySqlDbType.VarChar, 50); parms[37].Value = p_FaceHomes_Id;
            parms[38] = new MySqlParameter("@in_FaceHomes_Psw", MySqlDbType.VarChar, 50); parms[38].Value = p_FaceHomes_Psw;


            parms[39] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[40] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[39].Direction = ParameterDirection.Output;
            parms[40].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_data_Modify", parms);
                return (int)parms[39].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }








        public bool Del_face_m_unit_data(int p_User_Self_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_User_Self_Code", MySqlDbType.Int32); parms[0].Value = p_User_Self_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_data_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_decorated(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name,
                                                     string p_Deco_Proj, DateTime p_Request_B_Date, DateTime p_Request_E_Date, string p_Deco_Corp, string p_Deco_CorpMaster,
                                                     string p_License, string p_Tele, decimal p_Sum_Deposit, decimal p_Sum_Reduction, decimal p_Sum_Return,
                                                     bool p_Accep_Checked_1, DateTime p_Accep_Date_1, string p_Accep_Name_1, string p_Accep_Remark_1, bool p_Accep_Checked_2,
                                                     DateTime p_Accep_Date_2, string p_Accep_Name_2, string p_Accep_Remark_2, string p_Last_UserName, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[28];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_Name;
            parms[5] = new MySqlParameter("@in_Deco_Proj", MySqlDbType.VarChar, 20); parms[5].Value = p_Deco_Proj;
            parms[6] = new MySqlParameter("@in_Request_B_Date", MySqlDbType.Date); parms[6].Value = p_Request_B_Date;
            parms[7] = new MySqlParameter("@in_Request_E_Date", MySqlDbType.Date); parms[7].Value = p_Request_E_Date;
            parms[8] = new MySqlParameter("@in_Deco_Corp", MySqlDbType.VarChar, 50); parms[8].Value = p_Deco_Corp;
            parms[9] = new MySqlParameter("@in_Deco_CorpMaster", MySqlDbType.VarChar, 50); parms[9].Value = p_Deco_CorpMaster;

            parms[10] = new MySqlParameter("@in_License", MySqlDbType.VarChar, 20); parms[10].Value = p_License;
            parms[11] = new MySqlParameter("@in_Tele", MySqlDbType.VarChar, 50); parms[11].Value = p_Tele;
            parms[12] = new MySqlParameter("@in_Sum_Deposit", MySqlDbType.Decimal); parms[12].Value = p_Sum_Deposit;
            parms[13] = new MySqlParameter("@in_Sum_Reduction", MySqlDbType.Decimal); parms[13].Value = p_Sum_Reduction;
            parms[14] = new MySqlParameter("@in_Sum_Return", MySqlDbType.Decimal); parms[14].Value = p_Sum_Return;
            parms[15] = new MySqlParameter("@in_Accep_Checked_1", MySqlDbType.Bit); parms[15].Value = p_Accep_Checked_1;
            parms[16] = new MySqlParameter("@in_Accep_Date_1", MySqlDbType.Date); parms[16].Value = p_Accep_Date_1;
            parms[17] = new MySqlParameter("@in_Accep_Name_1", MySqlDbType.VarChar, 20); parms[17].Value = p_Accep_Name_1;
            parms[18] = new MySqlParameter("@in_Accep_Remark_1", MySqlDbType.VarChar, 255); parms[18].Value = p_Accep_Remark_1;
            parms[19] = new MySqlParameter("@in_Accep_Checked_2", MySqlDbType.Bit); parms[19].Value = p_Accep_Checked_2;

            parms[20] = new MySqlParameter("@in_Accep_Date_2", MySqlDbType.Date); parms[20].Value = p_Accep_Date_2;
            parms[21] = new MySqlParameter("@in_Accep_Name_2", MySqlDbType.VarChar, 20); parms[21].Value = p_Accep_Name_2;
            parms[22] = new MySqlParameter("@in_Accep_Remark_2", MySqlDbType.VarChar, 255); parms[22].Value = p_Accep_Remark_2;
            parms[23] = new MySqlParameter("@in_Last_UserName", MySqlDbType.VarChar, 20); parms[23].Value = p_Last_UserName;
            parms[24] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.DateTime); parms[24].Value = p_Last_UpDate;


            parms[25] = new MySqlParameter("@New_DecoNo", MySqlDbType.Int32);
            parms[26] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[27] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[25].Direction = ParameterDirection.Output;
            parms[26].Direction = ParameterDirection.Output;
            parms[27].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_decorated_Insert", parms);
                return (int)parms[26].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_unit_decorated(int p_DecoNo, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name,
                                                     string p_Deco_Proj, DateTime p_Request_B_Date, DateTime p_Request_E_Date, string p_Deco_Corp, string p_Deco_CorpMaster,
                                                     string p_License, string p_Tele, decimal p_Sum_Deposit, decimal p_Sum_Reduction, decimal p_Sum_Return,
                                                     bool p_Accep_Checked_1, DateTime p_Accep_Date_1, string p_Accep_Name_1, string p_Accep_Remark_1, bool p_Accep_Checked_2,
                                                     DateTime p_Accep_Date_2, string p_Accep_Name_2, string p_Accep_Remark_2, string p_Last_UserName, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[28];
            parms[0] = new MySqlParameter("@in_DecoNo", MySqlDbType.Int32); parms[0].Value = p_DecoNo;
            parms[1] = new MySqlParameter("@in_Self_Communtty_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Name;
            parms[6] = new MySqlParameter("@in_Deco_Proj", MySqlDbType.VarChar, 20); parms[6].Value = p_Deco_Proj;
            parms[7] = new MySqlParameter("@in_Request_B_Date", MySqlDbType.Date); parms[7].Value = p_Request_B_Date;
            parms[8] = new MySqlParameter("@in_Request_E_Date", MySqlDbType.Date); parms[8].Value = p_Request_E_Date;
            parms[9] = new MySqlParameter("@in_Deco_Corp", MySqlDbType.VarChar, 50); parms[9].Value = p_Deco_Corp;
            parms[10] = new MySqlParameter("@in_Deco_CorpMaster", MySqlDbType.VarChar, 50); parms[10].Value = p_Deco_CorpMaster;

            parms[11] = new MySqlParameter("@in_License", MySqlDbType.VarChar, 20); parms[11].Value = p_License;
            parms[12] = new MySqlParameter("@in_Tele", MySqlDbType.VarChar, 50); parms[12].Value = p_Tele;
            parms[13] = new MySqlParameter("@in_Sum_Deposit", MySqlDbType.Decimal); parms[13].Value = p_Sum_Deposit;
            parms[14] = new MySqlParameter("@in_Sum_Reduction", MySqlDbType.Decimal); parms[14].Value = p_Sum_Reduction;
            parms[15] = new MySqlParameter("@in_Sum_Return", MySqlDbType.Decimal); parms[15].Value = p_Sum_Return;
            parms[16] = new MySqlParameter("@in_Accep_Checked_1", MySqlDbType.Bit); parms[16].Value = p_Accep_Checked_1;
            parms[17] = new MySqlParameter("@in_Accep_Date_1", MySqlDbType.Date); parms[17].Value = p_Accep_Date_1;
            parms[18] = new MySqlParameter("@in_Accep_Name_1", MySqlDbType.VarChar, 20); parms[18].Value = p_Accep_Name_1;
            parms[19] = new MySqlParameter("@in_Accep_Remark_1", MySqlDbType.VarChar, 255); parms[19].Value = p_Accep_Remark_1;
            parms[20] = new MySqlParameter("@in_Accep_Checked_2", MySqlDbType.Bit); parms[20].Value = p_Accep_Checked_2;

            parms[21] = new MySqlParameter("@in_Accep_Date_2", MySqlDbType.Date); parms[21].Value = p_Accep_Date_2;
            parms[22] = new MySqlParameter("@in_Accep_Name_2", MySqlDbType.VarChar, 20); parms[22].Value = p_Accep_Name_2;
            parms[23] = new MySqlParameter("@in_Accep_Remark_2", MySqlDbType.VarChar, 255); parms[23].Value = p_Accep_Remark_2;
            parms[24] = new MySqlParameter("@in_Last_UserName", MySqlDbType.VarChar, 20); parms[24].Value = p_Last_UserName;
            parms[25] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.DateTime); parms[25].Value = p_Last_UpDate;


            parms[26] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[27] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[26].Direction = ParameterDirection.Output;
            parms[27].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_decorated_Modify", parms);
                return (int)parms[26].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_unit_decorated(int p_DecoNo)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_DecoNo", MySqlDbType.Int32); parms[0].Value = p_DecoNo;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_decorated_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_deco_change(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                               int p_DecoNo, DateTime p_Req_Date, string p_Req_Name, string p_Req_Remark, string p_Req_Class,
                                               string p_Req_Project, string p_Req_Key_Word, string p_Req_Results, string p_Results_Man)
        {
            MySqlParameter[] parms = new MySqlParameter[16];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@in_DecoNo", MySqlDbType.Int32); parms[4].Value = p_DecoNo;
            parms[5] = new MySqlParameter("@in_Req_Date", MySqlDbType.Date); parms[5].Value = p_Req_Date;
            parms[6] = new MySqlParameter("@in_Req_Name", MySqlDbType.VarChar, 20); parms[6].Value = p_Req_Name;
            parms[7] = new MySqlParameter("@in_Req_Remark", MySqlDbType.VarChar, 255); parms[7].Value = p_Req_Remark;
            parms[8] = new MySqlParameter("@in_Req_Class", MySqlDbType.VarChar, 20); parms[8].Value = p_Req_Class;
            parms[9] = new MySqlParameter("@in_Req_Project", MySqlDbType.VarChar, 20); parms[9].Value = p_Req_Project;

            parms[10] = new MySqlParameter("@in_Req_Key_Word", MySqlDbType.VarChar, 20); parms[10].Value = p_Req_Key_Word;
            parms[11] = new MySqlParameter("@in_Req_Results", MySqlDbType.VarChar, 20); parms[11].Value = p_Req_Results;
            parms[12] = new MySqlParameter("@in_Results_Man", MySqlDbType.VarChar, 20); parms[12].Value = p_Results_Man;

            parms[13] = new MySqlParameter("@New_DChg_Code", MySqlDbType.Int32);
            parms[14] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[15] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[13].Direction = ParameterDirection.Output;
            parms[14].Direction = ParameterDirection.Output;
            parms[15].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_deco_change_Insert", parms);
                return (int)parms[14].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_unit_deco_change(int p_DChg_Code, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                               int p_DecoNo, DateTime p_Req_Date, string p_Req_Name, string p_Req_Remark, string p_Req_Class,
                                               string p_Req_Project, string p_Req_Key_Word, string p_Req_Results, string p_Results_Man)
        {
            MySqlParameter[] parms = new MySqlParameter[16];
            parms[0] = new MySqlParameter("@in_DChg_Code", MySqlDbType.Int32); parms[0].Value = p_DChg_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_DecoNo", MySqlDbType.Int32); parms[5].Value = p_DecoNo;
            parms[6] = new MySqlParameter("@in_Req_Date", MySqlDbType.Date); parms[6].Value = p_Req_Date;
            parms[7] = new MySqlParameter("@in_Req_Name", MySqlDbType.VarChar, 20); parms[7].Value = p_Req_Name;
            parms[8] = new MySqlParameter("@in_Req_Remark", MySqlDbType.VarChar, 255); parms[8].Value = p_Req_Remark;
            parms[9] = new MySqlParameter("@in_Req_Class", MySqlDbType.VarChar, 20); parms[9].Value = p_Req_Class;
            parms[10] = new MySqlParameter("@in_Req_Project", MySqlDbType.VarChar, 20); parms[10].Value = p_Req_Project;

            parms[11] = new MySqlParameter("@in_Req_Key_Word", MySqlDbType.VarChar, 20); parms[11].Value = p_Req_Key_Word;
            parms[12] = new MySqlParameter("@in_Req_Results", MySqlDbType.VarChar, 20); parms[12].Value = p_Req_Results;
            parms[13] = new MySqlParameter("@in_Results_Man", MySqlDbType.VarChar, 20); parms[13].Value = p_Results_Man;

            parms[14] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[15] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[14].Direction = ParameterDirection.Output;
            parms[15].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_deco_change_Modify", parms);
                return (int)parms[14].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_unit_deco_change(int p_DChg_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_DChg_Code", MySqlDbType.Int32); parms[0].Value = p_DChg_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_deco_change_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_deco_tracking(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, int p_DecoNo,
                                                DateTime p_Check_Date, string p_Check_Man, string p_Check_Type, string p_Check_Mark, decimal p_Fine_Deposit,
                                                decimal p_Fine_Cash)
        {
            MySqlParameter[] parms = new MySqlParameter[13];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@in_DecoNo", MySqlDbType.Int32); parms[4].Value = p_DecoNo;
            parms[5] = new MySqlParameter("@in_Check_Date", MySqlDbType.Date); parms[5].Value = p_Check_Date;
            parms[6] = new MySqlParameter("@in_Check_Man", MySqlDbType.VarChar, 20); parms[6].Value = p_Check_Man;
            parms[7] = new MySqlParameter("@in_Check_Type", MySqlDbType.VarChar, 255); parms[7].Value = p_Check_Type;
            parms[8] = new MySqlParameter("@in_Check_Mark", MySqlDbType.VarChar, 20); parms[8].Value = p_Check_Mark;
            parms[9] = new MySqlParameter("@in_Fine_Deposit", MySqlDbType.VarChar, 20); parms[9].Value = p_Fine_Deposit;

            parms[10] = new MySqlParameter("@in_Fine_Cash", MySqlDbType.VarChar, 20); parms[10].Value = p_Fine_Cash;

            parms[11] = new MySqlParameter("@New_DTra_Code", MySqlDbType.Int32);
            parms[12] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[13] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[11].Direction = ParameterDirection.Output;
            parms[12].Direction = ParameterDirection.Output;
            parms[13].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_deco_tracking_Insert", parms);
                return (int)parms[12].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_unit_deco_tracking(int p_DTra_Code, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, int p_DecoNo,
                                                DateTime p_Check_Date, string p_Check_Man, string p_Check_Type, string p_Check_Mark, decimal p_Fine_Deposit,
                                                decimal p_Fine_Cash)
        {
            MySqlParameter[] parms = new MySqlParameter[16];
            parms[0] = new MySqlParameter("@in_DTra_Code", MySqlDbType.Int32); parms[0].Value = p_DTra_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_DecoNo", MySqlDbType.Int32); parms[5].Value = p_DecoNo;
            parms[6] = new MySqlParameter("@in_Check_Date", MySqlDbType.Date); parms[6].Value = p_Check_Date;
            parms[7] = new MySqlParameter("@in_Check_Man", MySqlDbType.VarChar, 20); parms[7].Value = p_Check_Man;
            parms[8] = new MySqlParameter("@in_Check_Type", MySqlDbType.VarChar, 255); parms[8].Value = p_Check_Type;
            parms[9] = new MySqlParameter("@in_Check_Mark", MySqlDbType.VarChar, 20); parms[9].Value = p_Check_Mark;
            parms[10] = new MySqlParameter("@in_Fine_Deposit", MySqlDbType.VarChar, 20); parms[10].Value = p_Fine_Deposit;

            parms[11] = new MySqlParameter("@in_Fine_Cash", MySqlDbType.VarChar, 20); parms[11].Value = p_Fine_Cash;

            parms[12] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[13] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[12].Direction = ParameterDirection.Output;
            parms[13].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_deco_tracking_Modify", parms);
                return (int)parms[12].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_unit_deco_tracking(int p_DTra_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_DTra_Code", MySqlDbType.Int32); parms[0].Value = p_DTra_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_deco_tracking_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_priceset_rule(int p_Self_Community_Code, int p_Price_Code, string p_Price_Name, string p_Price_Type, string p_MachineType,
                                                  bool p_User_Define_Flag, string p_Price_Rule, string p_DependOn_Field, string p_Flag_Field, decimal p_From_Value,
                                                  decimal p_Until_Value, decimal p_SetPrice)
        {
            MySqlParameter[] parms = new MySqlParameter[15];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Price_Code", MySqlDbType.Int32); parms[1].Value = p_Price_Code;
            parms[2] = new MySqlParameter("@in_Price_Name", MySqlDbType.VarChar); parms[2].Value = p_Price_Name;
            parms[3] = new MySqlParameter("@in_Price_Type", MySqlDbType.VarChar); parms[3].Value = p_Price_Type;
            parms[4] = new MySqlParameter("@in_MachineType", MySqlDbType.VarChar); parms[4].Value = p_MachineType;
            parms[5] = new MySqlParameter("@in_User_Define_Flag", MySqlDbType.Bit); parms[5].Value = p_User_Define_Flag;
            parms[6] = new MySqlParameter("@in_Price_Rule", MySqlDbType.VarChar, 20); parms[6].Value = p_Price_Rule;
            parms[7] = new MySqlParameter("@in_DependOn_Field", MySqlDbType.VarChar, 255); parms[7].Value = p_DependOn_Field;
            parms[8] = new MySqlParameter("@in_Flag_Field", MySqlDbType.VarChar, 20); parms[8].Value = p_Flag_Field;
            parms[9] = new MySqlParameter("@in_From_Value", MySqlDbType.Decimal); parms[9].Value = p_From_Value;

            parms[10] = new MySqlParameter("@in_Until_Value", MySqlDbType.Decimal); parms[10].Value = p_Until_Value;
            parms[11] = new MySqlParameter("@in_SetPrice", MySqlDbType.Decimal); parms[11].Value = p_SetPrice;

            parms[12] = new MySqlParameter("@New_Price_Set_ID", MySqlDbType.Int32);
            parms[13] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[14] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[12].Direction = ParameterDirection.Output;
            parms[13].Direction = ParameterDirection.Output;
            parms[14].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_priceset_rule_Insert", parms);
                return (int)parms[13].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Modify_face_m_unit_priceset_rule(int p_Price_Set_ID, int p_Self_Community_Code, int p_Price_Code, string p_Price_Name, string p_Price_Type, string p_MachineType,
                                                  bool p_User_Define_Flag, string p_Price_Rule, string p_DependOn_Field, string p_Flag_Field, decimal p_From_Value,
                                                  decimal p_Until_Value, decimal p_SetPrice)
        {
            MySqlParameter[] parms = new MySqlParameter[15];
            parms[0] = new MySqlParameter("@in_Price_Set_ID", MySqlDbType.Int32); parms[0].Value = p_Price_Set_ID;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Price_Code", MySqlDbType.Int32); parms[2].Value = p_Price_Code;
            parms[3] = new MySqlParameter("@in_Price_Name", MySqlDbType.VarChar); parms[3].Value = p_Price_Name;
            parms[4] = new MySqlParameter("@in_Price_Type", MySqlDbType.VarChar); parms[4].Value = p_Price_Type;
            parms[5] = new MySqlParameter("@in_MachineType", MySqlDbType.VarChar); parms[5].Value = p_MachineType;
            parms[6] = new MySqlParameter("@in_User_Define_Flag", MySqlDbType.Bit); parms[6].Value = p_User_Define_Flag;
            parms[7] = new MySqlParameter("@in_Price_Rule", MySqlDbType.VarChar, 20); parms[7].Value = p_Price_Rule;
            parms[8] = new MySqlParameter("@in_DependOn_Field", MySqlDbType.VarChar, 255); parms[8].Value = p_DependOn_Field;
            parms[9] = new MySqlParameter("@in_Flag_Field", MySqlDbType.VarChar, 20); parms[9].Value = p_Flag_Field;
            parms[10] = new MySqlParameter("@in_From_Value", MySqlDbType.Decimal); parms[10].Value = p_From_Value;

            parms[11] = new MySqlParameter("@in_Until_Value", MySqlDbType.Decimal); parms[11].Value = p_Until_Value;
            parms[12] = new MySqlParameter("@in_SetPrice", MySqlDbType.Decimal); parms[12].Value = p_SetPrice;

            parms[13] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[14] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[13].Direction = ParameterDirection.Output;
            parms[14].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_priceset_rule_Modify", parms);
                return (int)parms[13].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        public bool Del_face_m_unit_priceset_rule(int p_Price_Set_ID)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Price_Set_ID", MySqlDbType.Int32); parms[0].Value = p_Price_Set_ID;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_priceset_rule_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }




        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_p_know(int p_Self_Community_Code, string p_ProjNo, string p_ProjName1, DateTime p_ProjDate1, DateTime p_ProjWillDate,
                                           DateTime p_ProjEndDate, string p_ProjType, string p_Proj_Name, string p_ProjSize, string p_ProjOrder,
                                           string p_ProjPaySource1, string p_ProjTel, string p_ProjAddress1, string p_ProjReport1, decimal p_ProjPay1,
                                           string p_ProjRecoName1, decimal p_ProjMens1, decimal p_ProjMan1, DateTime p_ProjRecoDate1, string p_Proj_Remark1,
                                           string p_Proj_Remark2, string p_Proj_Remark3, string p_ProjAddress2, DateTime p_ProjDate2, string p_ProjLeader,
                                           decimal p_ProjPay2, string p_ProjPaySource2, string p_ProjRecoName2, decimal p_ProjMens2, decimal p_ProjMan2,
                                           DateTime p_ProjRecoDate2, string p_ProjSaid, decimal p_ProjPay3, string p_ProjPaySource3, string p_ProjRecoName3,
                                           decimal p_ProjMens3, decimal p_ProjMan3, DateTime p_ProjRecoDate3, string p_ProjState, string p_Remark,
                                            DateTime p_LastUpDate, string p_LastUser)
        {
            MySqlParameter[] parms = new MySqlParameter[45];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_ProjNo", MySqlDbType.VarChar, 11); parms[1].Value = p_ProjNo;
            parms[2] = new MySqlParameter("@in_ProjName1", MySqlDbType.VarChar, 20); parms[2].Value = p_ProjName1;
            parms[3] = new MySqlParameter("@in_ProjDate1", MySqlDbType.Date); parms[3].Value = p_ProjDate1;
            parms[4] = new MySqlParameter("@in_ProjWillDate", MySqlDbType.Date); parms[4].Value = p_ProjWillDate;
            parms[5] = new MySqlParameter("@in_ProjEndDate", MySqlDbType.Date); parms[5].Value = p_ProjEndDate;
            parms[6] = new MySqlParameter("@in_ProjType", MySqlDbType.VarChar, 20); parms[6].Value = p_ProjType;
            parms[7] = new MySqlParameter("@in_Proj_Name", MySqlDbType.VarChar, 50); parms[7].Value = p_Proj_Name;
            parms[8] = new MySqlParameter("@in_ProjSize", MySqlDbType.VarChar, 50); parms[8].Value = p_ProjSize;
            parms[9] = new MySqlParameter("@in_ProjOrder", MySqlDbType.VarChar, 50); parms[9].Value = p_ProjOrder;

            parms[10] = new MySqlParameter("@in_ProjTel", MySqlDbType.VarChar, 30); parms[10].Value = p_ProjTel;
            parms[11] = new MySqlParameter("@in_ProjAddress1", MySqlDbType.VarChar, 50); parms[11].Value = p_ProjAddress1;
            parms[12] = new MySqlParameter("@in_ProjReport1", MySqlDbType.VarChar, 50); parms[12].Value = p_ProjReport1;
            parms[13] = new MySqlParameter("@in_ProjPay1", MySqlDbType.Decimal); parms[13].Value = p_ProjPay1;
            parms[14] = new MySqlParameter("@in_ProjPaySource1", MySqlDbType.VarChar, 50); parms[14].Value = p_ProjPaySource1;
            parms[15] = new MySqlParameter("@in_ProjRecoName1", MySqlDbType.VarChar, 20); parms[15].Value = p_ProjRecoName1;
            parms[16] = new MySqlParameter("@in_ProjMens1", MySqlDbType.Decimal); parms[16].Value = p_ProjMens1;
            parms[17] = new MySqlParameter("@in_ProjMan1", MySqlDbType.Decimal); parms[17].Value = p_ProjMan1;
            parms[18] = new MySqlParameter("@in_ProjRecoDate1", MySqlDbType.Date); parms[18].Value = p_ProjRecoDate1;
            parms[19] = new MySqlParameter("@in_Proj_Remark1", MySqlDbType.Text); parms[19].Value = p_Proj_Remark1;

            parms[20] = new MySqlParameter("@in_Proj_Remark2", MySqlDbType.Text); parms[20].Value = p_Proj_Remark2;
            parms[21] = new MySqlParameter("@in_Proj_Remark3", MySqlDbType.Text); parms[21].Value = p_Proj_Remark3;
            parms[22] = new MySqlParameter("@in_ProjAddress2", MySqlDbType.VarChar, 50); parms[22].Value = p_ProjAddress2;
            parms[23] = new MySqlParameter("@in_ProjDate2", MySqlDbType.Date); parms[23].Value = p_ProjDate2;
            parms[24] = new MySqlParameter("@in_ProjLeader", MySqlDbType.VarChar, 40); parms[24].Value = p_ProjLeader;
            parms[25] = new MySqlParameter("@in_ProjPay2", MySqlDbType.Decimal); parms[25].Value = p_ProjPay2;
            parms[26] = new MySqlParameter("@in_ProjPaySource2", MySqlDbType.VarChar, 50); parms[26].Value = p_ProjPaySource2;
            parms[27] = new MySqlParameter("@in__ProjRecoName2", MySqlDbType.VarChar, 20); parms[27].Value = p_ProjRecoName2;
            parms[28] = new MySqlParameter("@in_ProjMens2", MySqlDbType.Decimal); parms[28].Value = p_ProjMens2;
            parms[29] = new MySqlParameter("@in_ProjMan2", MySqlDbType.Decimal); parms[29].Value = p_ProjMan2;

            parms[30] = new MySqlParameter("@in__ProjRecoDate2", MySqlDbType.Date); parms[30].Value = p_ProjRecoDate2;
            parms[31] = new MySqlParameter("@in_ProjSaid", MySqlDbType.VarChar, 50); parms[31].Value = p_ProjSaid;
            parms[32] = new MySqlParameter("@in_ProjPay3", MySqlDbType.Decimal); parms[32].Value = p_ProjPay3;
            parms[33] = new MySqlParameter("@in_ProjPaySource3", MySqlDbType.VarChar, 50); parms[33].Value = p_ProjPaySource3;
            parms[34] = new MySqlParameter("@in_ProjRecoName3", MySqlDbType.VarChar, 20); parms[34].Value = p_ProjRecoName3;
            parms[35] = new MySqlParameter("@in_ProjMens3", MySqlDbType.Decimal); parms[35].Value = p_ProjMens3;
            parms[36] = new MySqlParameter("@in_ProjMan3", MySqlDbType.Decimal); parms[36].Value = p_ProjMan3;
            parms[37] = new MySqlParameter("@in_ProjRecoDate3", MySqlDbType.Date); parms[37].Value = p_ProjRecoDate3;
            parms[38] = new MySqlParameter("@in_ProjState", MySqlDbType.VarChar, 20); parms[38].Value = p_ProjState;
            parms[39] = new MySqlParameter("@in_Remark", MySqlDbType.VarChar, 50); parms[39].Value = p_Remark;

            parms[40] = new MySqlParameter("@in_LastUpDate", MySqlDbType.DateTime); parms[40].Value = p_LastUpDate;
            parms[41] = new MySqlParameter("@in_LastUser", MySqlDbType.VarChar, 20); parms[41].Value = p_LastUser;

            parms[42] = new MySqlParameter("@New_Know_Code", MySqlDbType.Int32);
            parms[43] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[44] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[42].Direction = ParameterDirection.Output;
            parms[43].Direction = ParameterDirection.Output;
            parms[44].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_p_know_Insert", parms);
                return (int)parms[43].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Modify_face_m_unit_p_know(int p_Know_Code, int p_Self_Community_Code, string p_ProjNo, string p_ProjName1, DateTime p_ProjDate1, DateTime p_ProjWillDate,
                                           DateTime p_ProjEndDate, string p_ProjType, string p_Proj_Name, string p_ProjSize, string p_ProjOrder,
                                           string p_ProjPaySource1, string p_ProjTel, string p_ProjAddress1, string p_ProjReport1, decimal p_ProjPay1,
                                           string p_ProjRecoName1, decimal p_ProjMens1, decimal p_ProjMan1, DateTime p_ProjRecoDate1, string p_Proj_Remark1,
                                           string p_Proj_Remark2, string p_Proj_Remark3, string p_ProjAddress2, DateTime p_ProjDate2, string p_ProjLeader,
                                           decimal p_ProjPay2, string p_ProjPaySource2, string p_ProjRecoName2, decimal p_ProjMens2, decimal p_ProjMan2,
                                           DateTime p_ProjRecoDate2, string p_ProjSaid, decimal p_ProjPay3, string p_ProjPaySource3, string p_ProjRecoName3,
                                           decimal p_ProjMens3, decimal p_ProjMan3, DateTime p_ProjRecoDate3, string p_ProjState, string p_Remark,
                                            DateTime p_LastUpDate, string p_LastUser)
        {
            MySqlParameter[] parms = new MySqlParameter[45];
            parms[0] = new MySqlParameter("@in_Know_Code", MySqlDbType.Int32); parms[0].Value = p_Know_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_ProjNo", MySqlDbType.VarChar, 11); parms[2].Value = p_ProjNo;
            parms[3] = new MySqlParameter("@in_ProjName1", MySqlDbType.VarChar, 20); parms[3].Value = p_ProjName1;
            parms[4] = new MySqlParameter("@in_ProjDate1", MySqlDbType.Date); parms[4].Value = p_ProjDate1;
            parms[5] = new MySqlParameter("@in_ProjWillDate", MySqlDbType.Date); parms[5].Value = p_ProjWillDate;
            parms[6] = new MySqlParameter("@in_ProjEndDate", MySqlDbType.Date); parms[6].Value = p_ProjEndDate;
            parms[7] = new MySqlParameter("@in_ProjType", MySqlDbType.VarChar, 20); parms[7].Value = p_ProjType;
            parms[8] = new MySqlParameter("@in_Proj_Name", MySqlDbType.VarChar, 50); parms[8].Value = p_Proj_Name;
            parms[9] = new MySqlParameter("@in_ProjSize", MySqlDbType.VarChar, 50); parms[9].Value = p_ProjSize;
            parms[10] = new MySqlParameter("@in_ProjOrder", MySqlDbType.VarChar, 50); parms[10].Value = p_ProjOrder;

            parms[11] = new MySqlParameter("@in_ProjTel", MySqlDbType.VarChar, 30); parms[11].Value = p_ProjTel;
            parms[12] = new MySqlParameter("@in_ProjAddress1", MySqlDbType.VarChar, 50); parms[12].Value = p_ProjAddress1;
            parms[13] = new MySqlParameter("@in_ProjReport1", MySqlDbType.VarChar, 50); parms[13].Value = p_ProjReport1;
            parms[14] = new MySqlParameter("@in_ProjPay1", MySqlDbType.Decimal); parms[14].Value = p_ProjPay1;
            parms[15] = new MySqlParameter("@in_ProjPaySource1", MySqlDbType.VarChar, 50); parms[15].Value = p_ProjPaySource1;
            parms[16] = new MySqlParameter("@in_ProjRecoName1", MySqlDbType.VarChar, 20); parms[16].Value = p_ProjRecoName1;
            parms[17] = new MySqlParameter("@in_ProjMens1", MySqlDbType.Decimal); parms[17].Value = p_ProjMens1;
            parms[18] = new MySqlParameter("@in_ProjMan1", MySqlDbType.Decimal); parms[18].Value = p_ProjMan1;
            parms[19] = new MySqlParameter("@in_ProjRecoDate1", MySqlDbType.Date); parms[19].Value = p_ProjRecoDate1;
            parms[20] = new MySqlParameter("@in_Proj_Remark1", MySqlDbType.Text); parms[20].Value = p_Proj_Remark1;

            parms[21] = new MySqlParameter("@in_Proj_Remark2", MySqlDbType.Text); parms[21].Value = p_Proj_Remark2;
            parms[22] = new MySqlParameter("@in_Proj_Remark3", MySqlDbType.Text); parms[22].Value = p_Proj_Remark3;
            parms[23] = new MySqlParameter("@in_ProjAddress2", MySqlDbType.VarChar, 50); parms[23].Value = p_ProjAddress2;
            parms[24] = new MySqlParameter("@in_ProjDate2", MySqlDbType.Date); parms[24].Value = p_ProjDate2;
            parms[25] = new MySqlParameter("@in_ProjLeader", MySqlDbType.VarChar, 40); parms[25].Value = p_ProjLeader;
            parms[26] = new MySqlParameter("@in_ProjPay2", MySqlDbType.Decimal); parms[26].Value = p_ProjPay2;
            parms[27] = new MySqlParameter("@in_ProjPaySource2", MySqlDbType.VarChar, 50); parms[27].Value = p_ProjPaySource2;
            parms[28] = new MySqlParameter("@in__ProjRecoName2", MySqlDbType.VarChar, 20); parms[28].Value = p_ProjRecoName2;
            parms[29] = new MySqlParameter("@in_ProjMens2", MySqlDbType.Decimal); parms[29].Value = p_ProjMens2;
            parms[30] = new MySqlParameter("@in_ProjMan2", MySqlDbType.Decimal); parms[30].Value = p_ProjMan2;

            parms[31] = new MySqlParameter("@in__ProjRecoDate2", MySqlDbType.Date); parms[31].Value = p_ProjRecoDate2;
            parms[32] = new MySqlParameter("@in_ProjSaid", MySqlDbType.VarChar, 50); parms[32].Value = p_ProjSaid;
            parms[33] = new MySqlParameter("@in_ProjPay3", MySqlDbType.Decimal); parms[33].Value = p_ProjPay3;
            parms[34] = new MySqlParameter("@in_ProjPaySource3", MySqlDbType.VarChar, 50); parms[34].Value = p_ProjPaySource3;
            parms[35] = new MySqlParameter("@in_ProjRecoName3", MySqlDbType.VarChar, 20); parms[35].Value = p_ProjRecoName3;
            parms[36] = new MySqlParameter("@in_ProjMens3", MySqlDbType.Decimal); parms[36].Value = p_ProjMens3;
            parms[37] = new MySqlParameter("@in_ProjMan3", MySqlDbType.Decimal); parms[37].Value = p_ProjMan3;
            parms[38] = new MySqlParameter("@in_ProjRecoDate3", MySqlDbType.Date); parms[38].Value = p_ProjRecoDate3;
            parms[39] = new MySqlParameter("@in_ProjState", MySqlDbType.VarChar, 20); parms[39].Value = p_ProjState;
            parms[40] = new MySqlParameter("@in_Remark", MySqlDbType.VarChar, 50); parms[40].Value = p_Remark;

            parms[41] = new MySqlParameter("@in_LastUpDate", MySqlDbType.DateTime); parms[41].Value = p_LastUpDate;
            parms[42] = new MySqlParameter("@in_LastUser", MySqlDbType.VarChar, 20); parms[42].Value = p_LastUser;

            parms[43] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[44] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[43].Direction = ParameterDirection.Output;
            parms[44].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_p_know_Modify", parms);
                return (int)parms[43].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Del_face_m_unit_p_know(int p_Know_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Know_Code", MySqlDbType.Int32); parms[0].Value = p_Know_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_p_know_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        /*----------------------------------------------------------------------------------------------------------------------------------*/

        public bool Add_face_m_unit_reccase(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name,
                                           DateTime p_Rec_Date, string p_Rec_U_Name, string p_Rec_U_Adviser, string p_Mis_Class, string p_Mis_Project,
                                           string p_Mis_Key_Word, string p_Mis_Remark, string p_Mis_Correct, string p_Mis_Results, string p_Results_Man,
                                           string p_Last_User, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[20];
            parms[0] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_Name;
            parms[5] = new MySqlParameter("@in_Rec_Date", MySqlDbType.Date); parms[5].Value = p_Rec_Date;
            parms[6] = new MySqlParameter("@in_Rec_U_Name", MySqlDbType.VarChar, 20); parms[6].Value = p_Rec_U_Name;
            parms[7] = new MySqlParameter("@in_Rec_U_Adviser", MySqlDbType.VarChar, 50); parms[7].Value = p_Rec_U_Adviser;
            parms[8] = new MySqlParameter("@in_Mis_Class", MySqlDbType.VarChar, 20); parms[8].Value = p_Mis_Class;
            parms[9] = new MySqlParameter("@in_Mis_Project", MySqlDbType.VarChar, 20); parms[9].Value = p_Mis_Project;

            parms[10] = new MySqlParameter("@in_Mis_Key_Word", MySqlDbType.VarChar, 20); parms[10].Value = p_Mis_Key_Word;
            parms[11] = new MySqlParameter("@in_Mis_Remark", MySqlDbType.VarChar, 200); parms[11].Value = p_Mis_Remark;
            parms[12] = new MySqlParameter("@in_Mis_Correct", MySqlDbType.VarChar, 200); parms[12].Value = p_Mis_Correct;
            parms[13] = new MySqlParameter("@in_Mis_Results", MySqlDbType.VarChar, 20); parms[13].Value = p_Mis_Results;
            parms[14] = new MySqlParameter("@in_Results_Man", MySqlDbType.VarChar, 20); parms[14].Value = p_Results_Man;
            parms[15] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[15].Value = p_Last_User;
            parms[16] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.DateTime); parms[16].Value = p_Last_UpDate;


            parms[17] = new MySqlParameter("@New_URec_Code", MySqlDbType.Int32);
            parms[18] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[19] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[17].Direction = ParameterDirection.Output;
            parms[18].Direction = ParameterDirection.Output;
            parms[19].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_reccase_Insert", parms);
                return (int)parms[18].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Modify_face_m_unit_reccase(int p_URec_Code, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name,
                                                  DateTime p_Rec_Date, string p_Rec_U_Name, string p_Rec_U_Adviser, string p_Mis_Class, string p_Mis_Project,
                                                  string p_Mis_Key_Word, string p_Mis_Remark, string p_Mis_Correct, string p_Mis_Results, string p_Results_Man,
                                                  string p_Last_User, DateTime p_Last_UpDate)
        {
            MySqlParameter[] parms = new MySqlParameter[20];
            parms[0] = new MySqlParameter("@in_URec_Code", MySqlDbType.Int32); parms[0].Value = p_URec_Code;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Name;
            parms[6] = new MySqlParameter("@in_Rec_Date", MySqlDbType.Date); parms[6].Value = p_Rec_Date;
            parms[7] = new MySqlParameter("@in_Rec_U_Name", MySqlDbType.VarChar, 20); parms[7].Value = p_Rec_U_Name;
            parms[8] = new MySqlParameter("@in_Rec_U_Adviser", MySqlDbType.VarChar, 50); parms[8].Value = p_Rec_U_Adviser;
            parms[9] = new MySqlParameter("@in_Mis_Class", MySqlDbType.VarChar, 20); parms[9].Value = p_Mis_Class;
            parms[10] = new MySqlParameter("@in_Mis_Project", MySqlDbType.VarChar, 20); parms[10].Value = p_Mis_Project;

            parms[11] = new MySqlParameter("@in_Mis_Key_Word", MySqlDbType.VarChar, 20); parms[11].Value = p_Mis_Key_Word;
            parms[12] = new MySqlParameter("@in_Mis_Remark", MySqlDbType.VarChar, 200); parms[12].Value = p_Mis_Remark;
            parms[13] = new MySqlParameter("@in_Mis_Correct", MySqlDbType.VarChar, 200); parms[13].Value = p_Mis_Correct;
            parms[14] = new MySqlParameter("@in_Mis_Results", MySqlDbType.VarChar, 20); parms[14].Value = p_Mis_Results;
            parms[15] = new MySqlParameter("@in_Results_Man", MySqlDbType.VarChar, 20); parms[15].Value = p_Results_Man;
            parms[16] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[16].Value = p_Last_User;
            parms[17] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.DateTime); parms[17].Value = p_Last_UpDate;


            parms[18] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[19] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[18].Direction = ParameterDirection.Output;
            parms[19].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_reccase_Modify", parms);
                return (int)parms[18].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }



        public bool Del_face_m_unit_reccase(int p_URec_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_URec_Code", MySqlDbType.Int32); parms[0].Value = p_URec_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_reccase_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }





        /*----------------------------------------------------------------------------------------------------------------------------------*/






        public bool Add_face_m_unit_useddata(string p_MonthOf, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                             string p_Self_Name, string p_Price_Type, string p_MachineType, decimal p_OldRead_Qty, decimal p_NowRead_Qty,
                                             decimal p_MachUse_Qty, decimal p_N_Times, decimal p_RealUse_Qty, decimal p_RealUse_SumData, string p_Last_User,
                                             DateTime p_Last_UpDate, bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[20];
            parms[0] = new MySqlParameter("@in_MonthOf", MySqlDbType.VarChar, 6); parms[0].Value = p_MonthOf;
            parms[1] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[1].Value = p_Self_Community_Code;
            parms[2] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Build_Code;
            parms[3] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Unit_Code;
            parms[4] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[4].Value = p_U_Self_No;
            parms[5] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[5].Value = p_Self_Name;
            parms[6] = new MySqlParameter("@in_Price_Type", MySqlDbType.VarChar, 50); parms[6].Value = p_Price_Type;
            parms[7] = new MySqlParameter("@in_MachineType", MySqlDbType.VarChar, 50); parms[7].Value = p_MachineType;
            parms[8] = new MySqlParameter("@in_OldRead_Qty", MySqlDbType.Decimal); parms[8].Value = p_OldRead_Qty;
            parms[9] = new MySqlParameter("@in_NowRead_Qty", MySqlDbType.Decimal); parms[9].Value = p_NowRead_Qty;

            parms[10] = new MySqlParameter("@in_MachUse_Qty", MySqlDbType.Decimal); parms[10].Value = p_MachUse_Qty;
            parms[11] = new MySqlParameter("@in_N_Times", MySqlDbType.Decimal); parms[11].Value = p_N_Times;
            parms[12] = new MySqlParameter("@in_RealUse_Qty", MySqlDbType.Decimal); parms[12].Value = p_RealUse_Qty;
            parms[13] = new MySqlParameter("@in_RealUse_SumData", MySqlDbType.Decimal); parms[13].Value = p_RealUse_SumData;
            parms[14] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[14].Value = p_Last_User;
            parms[15] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.DateTime); parms[15].Value = p_Last_UpDate;
            parms[16] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[16].Value = p_Last_UpDate;


            parms[17] = new MySqlParameter("@New_Use_Code ", MySqlDbType.Int32);
            parms[18] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[19] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[17].Direction = ParameterDirection.Output;
            parms[18].Direction = ParameterDirection.Output;
            parms[19].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_useddata_Insert", parms);
                return (int)parms[18].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Modify_face_m_unit_useddata(int p_Use_Code, string p_MonthOf, int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No,
                                                    string p_Self_Name, string p_Price_Type, string p_MachineType, decimal p_OldRead_Qty, decimal p_NowRead_Qty,
                                                    decimal p_MachUse_Qty, decimal p_N_Times, decimal p_RealUse_Qty, decimal p_RealUse_SumData, string p_Last_User,
                                                    DateTime p_Last_UpDate, bool p_MyStatus)
        {
            MySqlParameter[] parms = new MySqlParameter[20];
            parms[0] = new MySqlParameter("@in_Use_Code", MySqlDbType.Int32); parms[0].Value = p_Use_Code;
            parms[1] = new MySqlParameter("@in_MonthOf", MySqlDbType.VarChar, 6); parms[1].Value = p_MonthOf;
            parms[2] = new MySqlParameter("@in_Self_Community_Code", MySqlDbType.Int32); parms[2].Value = p_Self_Community_Code;
            parms[3] = new MySqlParameter("@in_Self_Build_Code", MySqlDbType.Int32); parms[3].Value = p_Self_Build_Code;
            parms[4] = new MySqlParameter("@in_Self_Unit_Code", MySqlDbType.Int32); parms[4].Value = p_Self_Unit_Code;
            parms[5] = new MySqlParameter("@in_U_Self_No", MySqlDbType.Int32); parms[5].Value = p_U_Self_No;
            parms[6] = new MySqlParameter("@in_Self_Name", MySqlDbType.VarChar, 50); parms[6].Value = p_Self_Name;
            parms[7] = new MySqlParameter("@in_Price_Type", MySqlDbType.VarChar, 50); parms[7].Value = p_Price_Type;
            parms[8] = new MySqlParameter("@in_MachineType", MySqlDbType.VarChar, 50); parms[8].Value = p_MachineType;
            parms[9] = new MySqlParameter("@in_OldRead_Qty", MySqlDbType.Decimal); parms[9].Value = p_OldRead_Qty;
            parms[10] = new MySqlParameter("@in_NowRead_Qty", MySqlDbType.Decimal); parms[10].Value = p_NowRead_Qty;

            parms[11] = new MySqlParameter("@in_MachUse_Qty", MySqlDbType.Decimal); parms[11].Value = p_MachUse_Qty;
            parms[12] = new MySqlParameter("@in_N_Times", MySqlDbType.Decimal); parms[12].Value = p_N_Times;
            parms[13] = new MySqlParameter("@in_RealUse_Qty", MySqlDbType.Decimal); parms[13].Value = p_RealUse_Qty;
            parms[14] = new MySqlParameter("@in_RealUse_SumData", MySqlDbType.Decimal); parms[14].Value = p_RealUse_SumData;
            parms[15] = new MySqlParameter("@in_Last_User", MySqlDbType.VarChar, 20); parms[15].Value = p_Last_User;
            parms[16] = new MySqlParameter("@in_Last_UpDate", MySqlDbType.DateTime); parms[16].Value = p_Last_UpDate;
            parms[17] = new MySqlParameter("@in_MyStatus", MySqlDbType.Bit); parms[17].Value = p_Last_UpDate;


            parms[18] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[19] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[18].Direction = ParameterDirection.Output;
            parms[19].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_useddata_Modify", parms);
                return (int)parms[18].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Del_face_m_unit_useddata(int p_Use_Code)
        {
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@in_Use_Code", MySqlDbType.Int32); parms[0].Value = p_Use_Code;

            parms[1] = new MySqlParameter("@out_Res_Flags", MySqlDbType.Int32);
            parms[2] = new MySqlParameter("@out_Res_Remark", MySqlDbType.VarChar, 50);
            parms[1].Direction = ParameterDirection.Output;
            parms[2].Direction = ParameterDirection.Output;

            try
            {
                SqlHelper.MysqlHelper.ExecuteNonQuery(sCon, CommandType.StoredProcedure, "pro_face_m_unit_useddata_Delete", parms);
                return (int)parms[1].Value == 0;
            }
            catch (MySqlException e)
            {
                return false;
            }
        }


        public bool Del_StopView(int id)  //可以直接调用删除数据的过程
        {
            sql = "delete from face_m_stopview where Stop_Code=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool Del_p_Know(int id)   //可以直接调用删除数据的过程
        {
            sql = "delete from face_m_unit_p_know where Know_Code=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool Del_decorated(int id)   //可以直接调用删除数据的过程
        {
            sql = "delete from face_m_unit_decorated where DecoNo=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }


        public bool Del_decochange(int id)   //可以直接调用删除数据的过程
        {
            sql = "delete from face_m_unit_deco_change where DChg_Code=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }



        public DataTable Get_StopView(int communityId, int? id)
        {
            sql = "select a.*,b.community_name from face_m_stopview a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (id != null && id != 0)
                sql += " and a.self_community_code=" + id;
            sql += " order by Stop_Code ";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }


        public DataTable Get_p_know(int communityId, int? id)
        {
            sql = "select a.*,b.community_name from face_m_unit_p_know a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (id != null && id != 0)
                sql += " and a.self_community_code=" + id;
            sql += " order by Know_Code ";

            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }


        public DataTable Get_decorated(int communityId, int? id)
        {
            sql = "select a.*,b.community_name from face_m_unit_decorated a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (id != null && id != 0)
                sql += " and a.self_community_code=" + id;
            sql += " order by DecoNo ";

            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable Get_decochange(int communityId, int? sender_decono, int? id)
        {
            sql = "select a.*,b.community_name from face_m_unit_deco_change a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId + " and DecoNo=" + sender_decono;
            if (id != null && id != 0)
                sql += " and a.self_community_code=" + id;
            sql += " order by DecoNo,DChg_Code ";

            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable Get_decotracking(int communityId, int? sender_decono, int? id)
        {
            sql = "select a.*,b.community_name from face_m_unit_deco_tracking a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId + " and DecoNo=" + sender_decono;
            if (id != null && id != 0)
                sql += " and a.self_community_code=" + id;
            sql += " order by DecoNo,DTra_Code ";

            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        /*********************************************************************************************************************************************/
        /*********************************************************************************************************************************************/

        /*********************************************************************************************************************************************/
        /*********************************************************************************************************************************************/

        #region 楼盘管理
        /// <summary>
        /// 查找社区
        /// </summary>
        /// <param name="communityId">社区编号为NULL取全部</param>
        /// <returns></returns>
        public System.Data.DataTable GetCommunity(int? communityId,  bool includeChrild)
        {
            sql = "SELECT *, CASE WHEN self_layer=2 THEN CONCAT(REPEAT('|--',self_layer-1),community_name) WHEN self_layer>2 THEN CONCAT('|--',REPEAT('--',self_layer-2),community_name) ELSE community_name END AS treename FROM face_m_community where 1=1";
            if (communityId != null && communityId != 0)
            {
                if (includeChrild)
                {
                    sql += " and self_all_code like '" + communityId.ToString() + "\\_%'";
                }
                else
                {
                    sql += " and self_community_code=" + communityId;
                }
            }
            sql += " order by self_all_code,self_sortid";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

    
        public  int GetCommunityIdByDomain(string sDomain)
        {
            sql = "select self_community_code from face_m_community where urlsite='" + sDomain + "'";
            try
            {
                return Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, null));
            }
            catch
            {
                return 0;
            }
        }

        public DataTable GetBuild(int communityId,int? buildId, bool includeChrild)
        {
            sql = "select *,b.community_name, CASE WHEN a.self_layer=2 THEN CONCAT(REPEAT('|--',a.self_layer-1),a.build_name) WHEN a.self_layer>2 THEN CONCAT('|--',REPEAT('--',a.self_layer-2),a.build_name) ELSE a.build_name END  AS treename from face_m_build a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (buildId != null && buildId != 0)
            {
                if (includeChrild)
                {
                    sql += " and a.self_all_code like '" + buildId.ToString() + "\\_%'";
                }
                else
                {
                    sql += " and a.self_build_code=" + buildId;
                }
            }
            sql += " order by a.self_all_code,a.self_sortid";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetBuild(int buildId)
        {
            sql = "select * from face_m_build where self_build_code=" + buildId;
            
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetUnit(int? communityId, int? buildId, int? unitId)
        {
            sql = "select a.*,b.community_name,c.build_name from face_m_unit_base a left join face_m_community b on a.self_community_code=b.self_community_code left join face_m_build c on a.self_build_code=c.self_build_code where 1=1";
            if (communityId != null && communityId != 0)
                sql += " and a.self_community_code=" + communityId;
            if (buildId != null && buildId != 0)
                sql += " and a.self_build_code=" + buildId;
            if (unitId != null && unitId != 0)
                sql += " and a.self_unit_code=" + unitId;
            sql += " order by a.self_sortid";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetUnit(int unitId)
        {
            sql = "select a.*,b.community_name,c.build_name from face_m_unit_base a left join face_m_community b on a.self_community_code=b.self_community_code left join face_m_build c on a.self_build_code=c.self_build_code where a.self_unit_code=" + unitId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }


        public DataTable GetUnitData(int communityId, int? buildId, int? unitId)
        {
            sql = "select a.*,b.community_name,c.build_name from face_m_unit_data a left join face_m_community b on a.self_community_code=b.self_community_code left join face_m_build c on a.self_build_code=c.self_build_code where 1=1";
            if (communityId != null && communityId != 0)
                sql += " and a.self_community_code=" + communityId;
            if (buildId != null && buildId != 0)
                sql += " and a.self_build_code=" + buildId;
            if (unitId != null && unitId != 0)
                sql += " and a.self_unit_code=" + unitId;
            sql += " order by a.self_sortid";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetUnitData(int unitDataId)
        {
            sql = "select a.*,b.community_name,c.build_name from face_m_unit_data a left join face_m_community b on a.self_community_code=b.self_community_code left join face_m_build c on a.self_build_code=c.self_build_code where a.user_self_code=" + unitDataId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }
        #endregion

        #region 客户管理
        /// <summary>
        /// 获取机构
        /// </summary>
        /// <param name="communityId"></param>
        /// <param name="includeChrild"></param>
        /// <returns></returns>
        public System.Data.DataTable GetColtd(int? colId, bool includeChrild)
        {
            sql = "SELECT *, CASE WHEN self_layer=2 THEN CONCAT(REPEAT('|--',self_layer-1),coltd_name) WHEN self_layer>2 THEN CONCAT('|--',REPEAT('--',self_layer-2),coltd_name) ELSE coltd_name END AS treename FROM face_m_coltd where 1=1";
            if (colId != null && colId != 0)
            {
                if (includeChrild)
                {
                    sql += " and self_all_code like '" + colId.ToString() + "\\_%'";
                }
                else
                {
                    sql += " and self_coltd_code=" + colId;
                }
            }
            sql += " order by self_all_code,self_sortid";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetDept(int colId, int? depId, bool includeChrild)
        {
            sql = "select *,b.coltd_name, CASE WHEN a.self_layer=2 THEN CONCAT(REPEAT('|--',a.self_layer-1),a.dep_name) WHEN a.self_layer>2 THEN CONCAT('|--',REPEAT('--',a.self_layer-2),a.dep_name) ELSE a.dep_name END  AS treename from face_m_dept a left join face_m_coltd b on a.self_coltd_code=b.self_coltd_code where a.self_coltd_code=" + colId;
            if (depId != null && depId != 0)
            {
                if (includeChrild)
                {
                    sql += " and a.self_all_code like '" + depId.ToString() + "\\_%'";
                }
                else
                {
                    sql += " and a.self_build_code=" + depId;
                }
            }
            sql += " order by a.self_all_code,a.self_sortid";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetDept(int depId)
        {
            sql = "select * from face_m_dept where self_dep_code=" + depId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }


        public DataTable GetEmp(int colId, int? depId)
        {
            sql = "select a.*,b.coltd_name,c.dep_name from face_m_emp a left join face_m_coltd b on a.self_coltd_code=b.self_coltd_code left join face_m_dept c on a.self_dep_code=c.self_dep_code where a.self_coltd_code=" + colId;
            if (depId != null && depId != 0)
                sql += " and a.self_dep_code=" + depId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetEmp(int empId)
        {
            sql = "select a.*,b.coltd_name,c.dep_name from face_m_emp a left join face_m_coltd b on a.self_coltd_code=b.self_coltd_code left join face_m_dept c on a.self_dep_code=c.self_dep_code where a.self_emp_code=" + empId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        #endregion

        #region 收楼管理
        #endregion

        #region 物业服务

        /// <summary>
        /// 添加投诉单
        /// </summary>
        /// <param name="p_Self_Community_Code"></param>
        /// <param name="p_Self_Build_Code"></param>
        /// <param name="p_Self_Unit_Code"></param>
        /// <param name="p_U_Self_No"></param>
        /// <param name="p_Self_Name"></param>
        /// <param name="p_U_RepName"></param>
        /// <param name="p_U_Rep_Date"></param>
        /// <param name="p_U_Rep_HomeTel"></param>
        /// <param name="p_U_Rep_Rmk1"></param>
        /// <param name="p_U_Rep_Something"></param>
        /// <param name="p_U_Rep_Sms_Falg"></param>
        /// <returns></returns>
        public bool Add_face_m_complaints(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name, string p_U_RepName, DateTime p_U_Rep_Date, string p_U_Rep_HomeTel, string p_U_Rep_Rmk1, string p_U_Rep_Something, bool p_U_Rep_Sms_Falg)
        {
            sql = "insert into face_m_complaints(self_community_code,self_build_code,self_unit_code,u_self_no,self_name,u_repname,u_rep_date,u_rep_hometel,u_rep_rmk1,u_rep_something,u_rep_sms_falg)";
            sql += " values(@self_community_code,@self_build_code,@self_unit_code,@u_self_no,@self_name,@u_repname,@u_rep_date,@u_rep_hometel,@u_rep_rmk1,@u_rep_something,@u_rep_sms_flag)";
            MySqlParameter[] parms = new MySqlParameter[11];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@self_build_code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@self_unit_code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@u_self_no", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@self_name", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_Name;
            parms[5] = new MySqlParameter("@u_repname", MySqlDbType.VarChar, 20); parms[5].Value = p_U_RepName;
            parms[6] = new MySqlParameter("@u_rep_date", MySqlDbType.DateTime); parms[6].Value = p_U_Rep_Date;
            parms[7] = new MySqlParameter("@u_rep_hometel", MySqlDbType.VarChar,20); parms[7].Value = p_U_Rep_HomeTel;
            parms[8] = new MySqlParameter("@u_rep_rmk1", MySqlDbType.VarChar,100); parms[8].Value = p_U_Rep_Rmk1;
            parms[9] = new MySqlParameter("@u_rep_something", MySqlDbType.Text); parms[9].Value = p_U_Rep_Something;
            parms[10] = new MySqlParameter("@u_rep_sms_flag", MySqlDbType.Bit); parms[10].Value = p_U_Rep_Sms_Falg;

            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 添加请修单
        /// </summary>
        /// <param name="p_Self_Community_Code"></param>
        /// <param name="p_Self_Build_Code"></param>
        /// <param name="p_Self_Unit_Code"></param>
        /// <param name="p_U_Self_No"></param>
        /// <param name="p_Self_Name"></param>
        /// <param name="p_U_RepName"></param>
        /// <param name="p_U_Rep_Date"></param>
        /// <param name="p_U_Rep_HomeTel"></param>
        /// <param name="p_U_Rep_Rmk1"></param>
        /// <param name="p_U_Rep_Something"></param>
        /// <param name="p_U_Rep_Sms_Falg"></param>
        /// <returns></returns>
        public bool Add_face_m_repair(int p_Self_Community_Code, int p_Self_Build_Code, int p_Self_Unit_Code, int p_U_Self_No, string p_Self_Name, string p_U_RepName, DateTime p_U_Rep_Date, string p_U_Rep_HomeTel, string p_U_Rep_Rmk1, string p_U_Rep_Something, bool p_U_Rep_Sms_Falg)
        {
            sql = "insert into face_m_complaints(self_community_code,self_build_code,self_unit_code,u_self_no,self_name,u_repname,u_rep_date,u_rep_hometel,u_rep_rmk1,u_rep_something,u_rep_sms_falg)";
            sql += " values(@self_community_code,@self_build_code,@self_unit_code,@u_self_no,@self_name,@u_repname,@u_rep_date,@u_rep_hometel,@u_rep_rmk1,@u_rep_something,@u_rep_sms_flag)";
            MySqlParameter[] parms = new MySqlParameter[11];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = p_Self_Community_Code;
            parms[1] = new MySqlParameter("@self_build_code", MySqlDbType.Int32); parms[1].Value = p_Self_Build_Code;
            parms[2] = new MySqlParameter("@self_unit_code", MySqlDbType.Int32); parms[2].Value = p_Self_Unit_Code;
            parms[3] = new MySqlParameter("@u_self_no", MySqlDbType.Int32); parms[3].Value = p_U_Self_No;
            parms[4] = new MySqlParameter("@self_name", MySqlDbType.VarChar, 50); parms[4].Value = p_Self_Name;
            parms[5] = new MySqlParameter("@u_repname", MySqlDbType.VarChar, 20); parms[5].Value = p_U_RepName;
            parms[6] = new MySqlParameter("@u_rep_date", MySqlDbType.DateTime); parms[6].Value = p_U_Rep_Date;
            parms[7] = new MySqlParameter("@u_rep_hometel", MySqlDbType.VarChar, 20); parms[7].Value = p_U_Rep_HomeTel;
            parms[8] = new MySqlParameter("@u_rep_rmk1", MySqlDbType.VarChar, 100); parms[8].Value = p_U_Rep_Rmk1;
            parms[9] = new MySqlParameter("@u_rep_something", MySqlDbType.Text); parms[9].Value = p_U_Rep_Something;
            parms[10] = new MySqlParameter("@u_rep_sms_flag", MySqlDbType.Bit); parms[10].Value = p_U_Rep_Sms_Falg;

            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }



        /// <summary>
        /// 获取请修单
        /// </summary>
        /// <param name="communityId"></param>
        /// <param name="buildId"></param>
        /// <param name="unitId"></param>
        /// <param name="selfId"></param>
        /// <param name="cltsNo"></param>
        /// <param name="recordNum"></param>
        /// <returns></returns>
        public DataTable GetRepairList(int communityId, int? buildId, int? unitId, int? selfId, string cltsNo, int? recordNum)
        {
            sql = "select a.*,a.repa_code as id,b.community_name,c.build_name,d.self_name as unit_name from face_m_repair a left join face_m_community b on a.self_community_code=b.self_community_code left join face_m_build c on a.self_build_code=c.self_build_code left join face_m_unit_base d on a.self_unit_code=d.self_unit_code where a.self_community_code=" + communityId;
            if (buildId != null && buildId != 0) sql += " and a.self_build_code=" + buildId;
            if (unitId != null && unitId != 0) sql += " and a.self_unit_code=" + unitId;
            if (selfId != null && selfId != 0) sql += " and a.u_self_no=" + selfId;
            if (cltsNo != string.Empty) sql += " and a.clts_no='" + cltsNo + "'";
            sql += " order by a.u_rep_date desc";
            if (recordNum != null && recordNum != 0) sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];    
        }

        public DataTable GetRepair(int id) {
            sql = "select * from face_m_repair where repa_code=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];    
        }
        /// <summary>
        /// 获取投诉单
        /// </summary>
        /// <param name="communityId"></param>
        /// <param name="buildId"></param>
        /// <param name="unitId"></param>
        /// <param name="selfId"></param>
        /// <param name="cltsNo"></param>
        /// <param name="recordNum"></param>
        /// <returns></returns>
        public DataTable GetComplaints(int communityId, int? buildId, int? unitId, int? selfId, string cltsNo, int? recordNum)
        {
            sql = "select a.*,comp_code as id,b.community_name,c.build_name,d.self_name as unit_name from face_m_complaints a left join face_m_community b on a.self_community_code=b.self_community_code left join face_m_build c on a.self_build_code=c.self_build_code left join face_m_unit_base d on a.self_unit_code=d.self_unit_code where a.self_community_code=" + communityId;
            if (buildId != null && buildId != 0) sql += " and a.self_build_code=" + buildId;
            if (unitId != null && unitId != 0) sql += " and a.self_unit_code=" + unitId;
            if (selfId != null && selfId != 0) sql += " and a.u_self_no=" + selfId;
            if (cltsNo != string.Empty) sql += " and a.clts_no='" + cltsNo + "'";
            sql += " order by a.u_rep_date desc";
            if (recordNum != null && recordNum != 0) sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];    
        }

        public DataTable GetComplaints(int id)
        {
            sql = "select * from face_m_complaints where comp_code=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }
        /// <summary>
        /// 获取请修与投诉
        /// </summary>
        /// <param name="communityId"></param>
        /// <param name="buildId"></param>
        /// <param name="unitId"></param>
        /// <param name="selfId"></param>
        /// <param name="cltsNo"></param>
        /// <param name="recordNum"></param>
        /// <returns></returns>
        public DataTable GetRepairAndComplaints(int communityId, int? buildId, int? unitId, int? selfId, string cltsNo, int? recordNum)
        {
            sql = "select repa_code as Id,clts_no,self_community_code,self_build_code,self_unit_code,u_self_no,self_name,u_repname,u_rep_date,u_rep_rmk1,1 as type from face_m_repair where self_community_code=" + communityId;
            if (buildId != null && buildId != 0) sql += " and self_build_code=" + buildId;
            if (unitId != null && unitId != 0) sql += " and self_unit_code=" + unitId;
            if (selfId != null && selfId != 0) sql += " and u_self_no=" + selfId;
            if (cltsNo != string.Empty) sql += " and clts_no='" + cltsNo + "'";
            sql += " order by u_rep_date desc";
            if (recordNum != null && recordNum != 0) sql += " limit 0," + recordNum;
            sql += " union all";
            sql = " select comp_code as Id,clts_no,self_community_code,self_build_code,self_unit_code,u_self_no,self_name,u_repname,u_rep_date,u_rep_rmk1,2 as type from face_m_complaints where self_community_code=" + communityId;
            if (buildId != null && buildId != 0) sql += " and self_build_code=" + buildId;
            if (unitId != null && unitId != 0) sql += " and self_unit_code=" + unitId;
            if (selfId != null && selfId != 0) sql += " and u_self_no=" + selfId;
            if (cltsNo != string.Empty) sql += " and clts_no='" + cltsNo + "'";
            sql += " order by u_rep_date desc";
            if (recordNum != null && recordNum != 0) sql += " limit 0," + recordNum;

            return SqlHelper.MysqlHelper.Query(sql).Tables[0];   
        }
        #endregion

        #region 费用管理

        public DataTable GetFeeList(int communityId, int? buildId, int? unitId, int? selfId, string sMonth)
        {
            sql = "select * from face_m_month_sum where self_community_code=" + communityId;
            if (buildId != null && buildId != 0) sql += " and self_build_code=" + buildId;
            if (unitId != null && unitId != 0) sql += " and self_unit_code=" + unitId;
            if (selfId != null && selfId != 0) sql += " and u_self_no=" + selfId;
            if (sMonth != string.Empty) sql += " and monthof='" + sMonth + "'";
            sql += " order by rec_date desc";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];   
        }

        public DataTable GetPriceType(int communityId, int? id,bool includeSystemDe)
        {
            sql = "select a.*,b.community_name from face_m_price_type a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (id != null && id != 0)
                sql += " and a.price_code=" + id;
            if (!includeSystemDe)
                sql += " and a.user_define_flag=0";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];   
        }

        public DataTable GetPriceType(int id)
        {
            sql = "select * from face_m_price_type where price_code=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];   
        }


        public DataTable GetPriceSetRule(int priceCode, int? priceSetId)
        {
            sql = "select a.*,b.price_name as p_price_name from face_m_unit_priceset_rule a left join face_m_price_type b on a.price_code=b.price_code where a.price_code=" + priceCode;
            if (priceSetId != null && priceSetId != 0)
                sql += " and a.price_set_id=" + priceSetId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetPriceSetRule(int priceSetId)
        {
            sql = "select a.*,b.price_name as p_price_name,b.self_community_code as p_self_community_code from face_m_unit_priceset_rule a left join face_m_price_type b on a.price_code=b.price_code where a.price_set_id=" + priceSetId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }
        #endregion
     
        #region 通知公告&民主决策
        /// <summary>
        /// 获取社区通知公告及议题
        /// </summary>
        /// <param name="communityId">社区ID</param>
        /// <param name="topicId">公告及议题ID</param>
        /// <param name="sType">类别</param>
        /// <returns></returns>
        public DataTable GetTopicList(int communityId, int? topicId, int? cid, string sType, int? recordNum)
        {
            sql = "select a.*,b.community_name from face_m_topic a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (topicId != null && topicId != 0)
                sql += " and topicid=" + topicId;
            if (cid != null && cid != 0)
                sql += " and classid=" + cid;
            if (sType != string.Empty)
                sql += " and Type='" + sType + "'";
            sql += " order by topicid desc";
            if (recordNum != null & recordNum != 0)
                sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }
        /// <summary>
        /// 获取单个
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DataTable GetTopic(int id)
        {
            sql = "select a.*,b.community_name from face_m_topic a left join face_m_community b on a.self_community_code=b.self_community_code where a.topicid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public int AddTopic(int communityId, int classId, string sType, string sTitle, string sContent,DateTime beginDate,DateTime endDate, string sVoteType)
        {
            sql = "insert into face_m_topic(self_community_code,classid,type,title,content,begindate,enddate,votetype,createdate,createuser) values(@self_community_code,@classid,@type,@title,@content,@begindate,@enddate,@votetype,now(),@empid);select @@identity";
            MySqlParameter[] parms = new MySqlParameter[9];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@classid", MySqlDbType.Int32); parms[1].Value = classId;
            parms[2] = new MySqlParameter("@type", MySqlDbType.VarChar, 10); parms[2].Value = sType;
            parms[3] = new MySqlParameter("@title", MySqlDbType.VarChar, 200); parms[3].Value = sTitle;
            parms[4] = new MySqlParameter("@content", MySqlDbType.Text); parms[4].Value = sContent;
            parms[5] = new MySqlParameter("@begindate", MySqlDbType.Date); parms[5].Value = beginDate;
            parms[6] = new MySqlParameter("@enddate", MySqlDbType.Date); parms[6].Value = endDate;
            parms[7] = new MySqlParameter("@votetype", MySqlDbType.VarChar, 20); parms[7].Value = sVoteType;
            parms[8] = new MySqlParameter("@empid", MySqlDbType.Int32); parms[8].Value = int.Parse(HttpContext.Current.Session["EmpId"].ToString());

            try
            {
                return Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, parms));
            }
            catch
            {
                return 0;
            }
        }

        public bool ModifyTopic(int id,int communityId, int classId, string sType, string sTitle, string sContent, DateTime beginDate, DateTime endDate, string sVoteType)
        {
            sql = "update face_m_topic set self_community_code=@self_community_code,classid=@classid,type=@type,title=@title,content=@content,begindate=@begindate,enddate=@enddate,votetype=@votetype where topicid=@id";
            MySqlParameter[] parms = new MySqlParameter[9];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@classid", MySqlDbType.Int32); parms[1].Value = classId;
            parms[2] = new MySqlParameter("@type", MySqlDbType.VarChar, 10); parms[2].Value = sType;
            parms[3] = new MySqlParameter("@title", MySqlDbType.VarChar, 200); parms[3].Value = sTitle;
            parms[4] = new MySqlParameter("@content", MySqlDbType.Text); parms[4].Value = sContent;
            parms[5] = new MySqlParameter("@begindate", MySqlDbType.Date); parms[5].Value = beginDate;
            parms[6] = new MySqlParameter("@enddate", MySqlDbType.Date); parms[6].Value = endDate;
            parms[7] = new MySqlParameter("@votetype", MySqlDbType.VarChar, 20); parms[7].Value = sVoteType;
            parms[8] = new MySqlParameter("@id", MySqlDbType.Int32); parms[8].Value = id;

            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelTopic(int id)
        {
            sql = "delete from face_m_topic where topicid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        public DataTable GetTopicVoteItemList(int topicId)
        {
            sql = "select * from face_m_topic_vote_item where topicid=" + topicId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddTopicVoteItem(int topicId, string sName)
        {
            sql = "insert into face_m_topic_vote_item(topicid,name) values(@topicid,@name)";
            MySqlParameter[] parms = new MySqlParameter[2];
            parms[0] = new MySqlParameter("@topicid", MySqlDbType.Int32); parms[0].Value = topicId;
            parms[1] = new MySqlParameter("@name", MySqlDbType.VarChar, 100); parms[1].Value = sName;

            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyTopicVoteItem(int id, string sName)
        {
            sql = "update face_m_topic_vote_item set name=@name where voteitemid=@id";
            MySqlParameter[] parms = new MySqlParameter[2];
            parms[0] = new MySqlParameter("@name", MySqlDbType.VarChar, 100); parms[0].Value = sName;
            parms[1] = new MySqlParameter("@id", MySqlDbType.Int32); parms[1].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelTopicVoteItem(int id)
        {
            sql = "delete from face_m_topic_vote_item where voteitemid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        public int GetTopicHDnum(int topicId,out bool isSelfSign)
        {
            int reInt = 0;
            sql = "select count(*) from face_m_topic_vote where topicid=" + topicId;
            reInt = Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, null));
            sql += " and empid=" + int.Parse(HttpContext.Current.Session["EmpId"].ToString());
            isSelfSign = Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, null)) > 0;
            return reInt;
        }

        public DataTable GetTopicVoteInfo(int topicId)
        {
            sql = "select a.voteitemid, count(b.votevalue) as votetotal,(count(b.votevalue)/(select count(1) from face_m_topic_vote where topicid=" + topicId + "))*100 as percent, a.name";
            sql += " from  face_m_topic_vote_item a left outer join face_m_topic_vote b on a.voteitemid=b.votevalue where a.topicId = " + topicId + " group by a.voteitemid";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool GetTopicIsSelfVote(int topicId)
        {
            sql = "select count(*) from face_m_topic_vote where topicid=" + topicId + "  and empid=" + int.Parse(HttpContext.Current.Session["EmpId"].ToString());
            return Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, null)) > 0;
        }

        public bool AddTopicVote(int topicId, int voteitemId, string rem)
        {
            sql = "insert into face_m_topic_vote(topicid,empid,votevalue,rem,createdate) values(@topicid,@empid,@votevalue,@rem,now())";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@topicid", MySqlDbType.Int32); parms[0].Value = topicId;
            parms[1] = new MySqlParameter("@empid", MySqlDbType.Int32); parms[1].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            parms[2] = new MySqlParameter("@votevalue", MySqlDbType.Int32); parms[2].Value = voteitemId;
            parms[3] = new MySqlParameter("@rem", MySqlDbType.Text); parms[3].Value = rem;

            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }
        #endregion

        #region 文档管理
        #endregion

        #region 政府机构

        public int CheckGovLogin(int communityId,string uid, string pwd)
        {
            sql = "select govaccountid from face_m_gov_account where self_community_code=@self_community_code and loginid=@loginid and pwd=@pwd";
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@loginid", MySqlDbType.VarChar, 20); parms[1].Value = uid;
            parms[2] = new MySqlParameter("@pwd", MySqlDbType.VarChar, 15); parms[2].Value = pwd;
            try
            {
                return Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, parms));
            }
            catch
            {
                return 0;
            }
        }

        public DataTable GetGovAccount(int communityId, int? govId)
        {
            sql = "select a.*,b.community_name from face_m_gov_account a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (govId != null && govId != 0)
                sql += " and a.govaccountid=" + govId;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];   
        }

        public DataTable GetGovAccount(int id)
        {
            sql = "select a.*,b.community_name from face_m_gov_account a left join face_m_community b on a.self_community_code=b.self_community_code where a.govaccountid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];   
        }

        public bool AddGovAccount(int communityId, string sLoginId, string sName, string sPwd)
        {
            sql = "insert into face_m_gov_account(self_community_code,loginid,username,pwd,createuser,createdate) values(@self_community_code,@loginid,@username,@pwd,@empid,now())";
            MySqlParameter[] parms = new MySqlParameter[5];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@loginid", MySqlDbType.VarChar, 20); parms[1].Value = sLoginId;
            parms[2] = new MySqlParameter("@username", MySqlDbType.VarChar, 50); parms[2].Value = sName;
            parms[3] = new MySqlParameter("@pwd", MySqlDbType.VarChar, 15); parms[3].Value = sPwd;
            parms[4] = new MySqlParameter("@empid", MySqlDbType.Int32); parms[4].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyGovAccount(int id,int communityId, string sLoginId, string sName, string sPwd)
        {
            MySqlParameter[] parms = new MySqlParameter[5];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@loginid", MySqlDbType.VarChar, 20); parms[1].Value = sLoginId;
            parms[2] = new MySqlParameter("@username", MySqlDbType.VarChar, 50); parms[2].Value = sName;
            sql = "update face_m_gov_account set self_community_code=@self_community_code,loginid=@loginid,username=@username";
            if (sPwd != string.Empty)
            {
                sql += ",pwd=@pwd";
                parms[3] = new MySqlParameter("@pwd", MySqlDbType.VarChar, 15); parms[3].Value = sPwd;
                parms[4] = new MySqlParameter("@id", MySqlDbType.Int32); parms[4].Value = id;
            }
            else
            {
                parms[3] = new MySqlParameter("@id", MySqlDbType.Int32); parms[3].Value = id;
            }
             sql += " where govaccountid=@id";
            
            
            
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelGovAccount(int id)
        {
            sql = "delete from face_m_gov_account where govaccountid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        public DataTable GetGovNewsList(int communityId, int? govId, int? newsId, int? recordNum)
        {
            sql = "select a.*,b.UserName,c.community_name from face_m_gov_news a left join face_m_gov_account b on a.accountid=b.govaccountid left join face_m_community c on b.self_community_code=c.self_community_code where b.self_community_code=" + communityId;
            if (govId != null && govId != 0)
                sql += " and a.accountid=" + govId;
            if (newsId != null && newsId != 0)
                sql += " and a.newsid=" + newsId;
            sql += " order by a.createdate desc";
            if (recordNum != null && recordNum != 0)
                sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];   
        }

        public DataTable GetGovNews(int id)
        {
            sql = "select a.*,b.UserName from face_m_gov_news a left join face_m_gov_account b on a.accountid=b.govaccountid where a.newsid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddGovNews(int govId, string sType, string sTitle, string sContent)
        {
            sql = "insert into face_m_gov_news(accountid,type,title,content,createdate) values(@govid,@type,@title,@content,now())";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@govid", MySqlDbType.Int32); parms[0].Value = govId;
            parms[1] = new MySqlParameter("@type", MySqlDbType.VarChar, 50); parms[1].Value = sType;
            parms[2] = new MySqlParameter("@title", MySqlDbType.VarChar, 50); parms[2].Value = sTitle;
            parms[3] = new MySqlParameter("@content", MySqlDbType.Text); parms[3].Value = sContent;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyGovNews(int id, string sType, string sTitle, string sContent)
        {
            sql = "update  face_m_gov_news set type=@type,title=@title,content=@content where newsid=@id";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@type", MySqlDbType.VarChar, 50); parms[0].Value = sType;
            parms[1] = new MySqlParameter("@title", MySqlDbType.VarChar, 50); parms[1].Value = sTitle;
            parms[2] = new MySqlParameter("@content", MySqlDbType.Text); parms[2].Value = sContent;
            parms[3] = new MySqlParameter("@id", MySqlDbType.Int32); parms[3].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelGovNews(int id)
        {
            sql = "delete from face_m_gov_news where newsid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }
        #endregion

        #region SHOW家园
        /// <summary>
        /// 获取社区网站简介
        /// </summary>
        /// <param name="communityId">社区ID</param>
        /// <param name="id">为空取所有</param>
        /// <returns></returns>
        public DataTable GetWebSiteIntroduce(int communityId, int? id)
        {
            sql = "select a.*,b.community_name,b.community_simplename from face_m_website_com_introduce a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (id != null)
                sql += " and a.introduceid=" + id;
            sql += " order by a.sort";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteIntroduce(int id)
        {
            sql = "select * from face_m_website_com_introduce where introduceid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddWebSiteIntroduce(int communityId, string sTitle, string sContent, int iSort)
        {
            sql = "insert into face_m_website_com_introduce(self_community_code,typename,typevalue,sort) values(@self_community_code,@typename,@typevalue,@sort)";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@typename", MySqlDbType.VarChar, 20); parms[1].Value = sTitle;
            parms[2] = new MySqlParameter("@typevalue", MySqlDbType.Text); parms[2].Value = sContent;
            parms[3] = new MySqlParameter("@sort", MySqlDbType.Int16); parms[3].Value = iSort;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyWebsiteIntroduce(int id, int communityId, string sTitle, string sContent, int iSort)
        {
            sql = "update face_m_website_com_introduce set self_community_code=@self_community_code,typename=@typename,typevalue=@typevalue,sort=@sort where introduceid=@id";
            MySqlParameter[] parms = new MySqlParameter[5];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@typename", MySqlDbType.VarChar, 20); parms[1].Value = sTitle;
            parms[2] = new MySqlParameter("@typevalue", MySqlDbType.Text); parms[2].Value = sContent;
            parms[3] = new MySqlParameter("@sort", MySqlDbType.Int16); parms[3].Value = iSort;
            parms[4] = new MySqlParameter("@id", MySqlDbType.Int32); parms[4].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteIntroduce(int id)
        {
            sql = "delete from face_m_website_com_introduce where introduceid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        /// <summary>
        /// 获取社区网站新闻类别
        /// </summary>
        /// <param name="communityId">社区ID</param>
        /// <param name="id">为空取所有</param>
        /// <returns></returns>
        public DataTable GetWebSiteNewsClass(int communityId, int? id)
        {
            sql = "select a.*,b.community_name from face_m_website_news_class a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (id != null && id != 0)
                sql += " and a.id=" + id;
            sql += " order by a.sort";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteNewsClass(int id)
        {
            sql = "select a.*,b.community_name from face_m_website_news_class a left join face_m_community b on a.self_community_code=b.self_community_code where a.id=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddWebSiteNewsClass(int communityId, string sName, int iSort)
        {
            sql = "insert into face_m_website_news_class(self_community_code,name,sort) values(@self_community_code,@name,@sort)";
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@name", MySqlDbType.VarChar, 20); parms[1].Value = sName;
            parms[2] = new MySqlParameter("@sort", MySqlDbType.Int16); parms[2].Value = iSort;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyWebSiteNewsClass(int id,int communityId, string sName, int iSort)
        {
            sql = "update face_m_website_news_class set self_community_code=@self_community_code,name=@name,sort=@sort where id=@id";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@name", MySqlDbType.VarChar, 20); parms[1].Value = sName;
            parms[2] = new MySqlParameter("@sort", MySqlDbType.Int16); parms[2].Value = iSort;
            parms[3] = new MySqlParameter("@id", MySqlDbType.Int32); parms[3].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteNewsClass(int id)
        {
            sql = "delete from face_m_website_news_class where id=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        /// <summary>
        /// 获取社区网站新闻列表
        /// </summary>
        /// <param name="communityId">社区ID</param>
        /// <param name="classId">新闻类别</param>
        /// <param name="newsId">新闻</param>
        /// <returns></returns>
        public DataTable GetWebSiteNewsList(int communityId, int? classId, int? newsId, int? recordNum)
        {
            sql = "select a.*,b.name as classname,c.community_name from face_m_website_news a left join face_m_website_news_class b on a.classid=b.id left join face_m_community c on a.self_community_code=c.self_community_code where a.self_community_code=" + communityId;
            if (newsId != null && newsId != 0)
                sql += " and a.newsid=" + newsId;
            else if (classId != null && classId != 0)
                sql += " and a.classid=" + classId;
            if (recordNum != null && recordNum != 0)
                sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteNews(int Id)
        {
            sql = "select a.*,b.name as classname,c.community_name from face_m_website_news a left join face_m_website_news_class b on a.classid=b.id left join face_m_community c on a.self_community_code=c.self_community_code where a.newsid=" + Id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        /// <summary>
        /// 获取社区网站图片新闻
        /// </summary>
        /// <param name="communityId">社区ID</param>
        /// <param name="classId">新闻类别</param>
        /// <param name="recordNum">记录数</param>
        /// <returns></returns>
        public DataTable GetWebSiteNewsPic(int communityId, int? classId, int? recordNum)
        {
            sql = "select * from face_m_website_news where ifnull(titlepic,'')<>'' and self_community_code=" + communityId;
            if (classId != null && classId != 0)
                sql += " and classid=" + classId;
            sql += " order by newsid desc";
            if (recordNum != null && recordNum != 0)
                sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddWebSiteNews(int communityId, int classId, string sTitle, string sTitlePic, string sContent)
        {
            sql = "insert into face_m_website_news(self_community_code,classid,title,content,titlepic) values(@self_community_code,@classid,@title,@content,@titlepic)";
            MySqlParameter[] parms = new MySqlParameter[5];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@classid", MySqlDbType.Int32); parms[1].Value =classId;
            parms[2] = new MySqlParameter("@title", MySqlDbType.VarChar,50); parms[2].Value = sTitle;
            parms[3] = new MySqlParameter("@content", MySqlDbType.Text); parms[3].Value = sContent;
            parms[4] = new MySqlParameter("@titlepic", MySqlDbType.VarChar, 50); parms[4].Value = sTitlePic;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyWebSiteNews( int id,int communityId, int classId, string sTitle, string sTitlePic, string sContent)
        {
            sql = "update face_m_website_news set self_community_code=@self_community_code,classid=@classid,title=@title,content=@content,titlepic=@titlepic where newsid=@id";
            MySqlParameter[] parms = new MySqlParameter[6];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@classid", MySqlDbType.Int32); parms[1].Value = classId;
            parms[2] = new MySqlParameter("@title", MySqlDbType.VarChar, 50); parms[2].Value = sTitle;
            parms[3] = new MySqlParameter("@content", MySqlDbType.Text); parms[3].Value = sContent;
            parms[4] = new MySqlParameter("@titlepic", MySqlDbType.VarChar, 50); parms[4].Value = sTitlePic;
            parms[5] = new MySqlParameter("@id", MySqlDbType.Int32); parms[5].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteNews(int id)
        {
            sql = "delete from face_m_website_news where newsid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }


        
        /// <summary>
        /// 获取社区公共通讯录
        /// </summary>
        /// <param name="communityId">社区ID</param>
        /// <param name="bookId">通讯录ID</param>
        /// <returns></returns>
        public DataTable GetWebSiteCommBook(int communityId, int? bookId)
        {
            sql = "select a.*,b.community_name from face_m_website_commbook a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (bookId != null)
                sql += " and a.commbookid=" + bookId;
            sql += " order by a.sort";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteCommBook(int id)
        {
            sql = "select a.*,b.community_name from face_m_website_commbook a left join face_m_community b on a.self_community_code=b.self_community_code where a.commbookid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddWebSiteCommBook(int communityId, string sTitle, string sUrl, string sRem, int iSort)
        {
            sql = "insert into face_m_website_commbook(self_community_code,booktitle,bookurl,bookrem,sort) values(@self_community_code,@booktitle,@bookurl,@bookrem,@sort)";
            MySqlParameter[] parms = new MySqlParameter[5];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@booktitle", MySqlDbType.VarChar, 100); parms[1].Value = sTitle;
            parms[2] = new MySqlParameter("@bookurl", MySqlDbType.VarChar, 100); parms[2].Value = sUrl;
            parms[3] = new MySqlParameter("@bookrem", MySqlDbType.VarChar, 200); parms[3].Value = sRem;
            parms[4] = new MySqlParameter("@sort", MySqlDbType.Int32); parms[4].Value = iSort;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyWebSiteCommBook(int bookId,int communityId, string sTitle, string sUrl, string sRem, int iSort)
        {
            sql = "update face_m_website_commbook set self_community_code=@self_community_code,booktitle=@booktitle,bookurl=@bookurl,bookrem=@bookrem,sort=@sort where commbookid=@id";
            MySqlParameter[] parms = new MySqlParameter[6];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@booktitle", MySqlDbType.VarChar, 100); parms[1].Value = sTitle;
            parms[2] = new MySqlParameter("@bookurl", MySqlDbType.VarChar, 100); parms[2].Value = sUrl;
            parms[3] = new MySqlParameter("@bookrem", MySqlDbType.VarChar, 200); parms[3].Value = sRem;
            parms[4] = new MySqlParameter("@sort", MySqlDbType.Int32); parms[4].Value = iSort;
            parms[5] = new MySqlParameter("@id", MySqlDbType.Int32); parms[5].Value = bookId;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteCommBook(int id)
        {
            sql = "delete from face_m_website_commbook where commbookid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 获取留言信息
        /// </summary>
        /// <param name="communityId">社区ID</param>
        /// <param name="empId">留言者</param>
        /// <param name="msgId">留言信息</param>
        /// <param name="recordNum">记录数</param>
        /// <returns></returns>
        public DataTable GetWebSiteLevMsg(int communityId, int? empId, int? msgId, int? recordNum)
        {
            sql = "select * from face_m_website_levmsg where self_community_code=" + communityId;
            if (msgId != null && msgId != 0)
                sql += " and msgid=" + msgId;
            if (empId != null && empId != 0)
                sql += " and empid=" + empId;
            sql += " order by msgid desc";
            if (recordNum != null && recordNum != 0)
                sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }
        #endregion

        #region 爱社区
        public DataTable GetWebSiteIBigClassList(int communityId, int? id)
        {
            sql = "select a.*,b.community_name from face_m_website_i_bigclass a left join face_m_community b on a.self_community_code=b.self_community_code where a.self_community_code=" + communityId;
            if (id != null && id != 0)
                sql += " and a.id=" + id;
            sql += " order by a.sort";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteIBigClass(int id)
        {
            sql = "select a.*,b.community_name from face_m_website_i_bigclass a left join face_m_community b on a.self_community_code=b.self_community_code where a.bigclassid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddWebSiteIBigClass(int communityId, string sName, int iSort)
        {
            sql = "insert into face_m_website_i_bigclass(self_community_code,name,sort) values(@self_community_code,@name,@sort)";
            MySqlParameter[] parms = new MySqlParameter[3];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@name", MySqlDbType.VarChar, 20); parms[1].Value = sName;
            parms[2] = new MySqlParameter("@sort", MySqlDbType.Int32); parms[2].Value = iSort;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyWebSiteIBigClass(int id, int communityId, string sName, int iSort)
        {
            sql = "update face_m_website_i_bigclass set self_community_code=@self_community_code,name=@name,sort=@sort where bigclassid=@id";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@self_community_code", MySqlDbType.Int32); parms[0].Value = communityId;
            parms[1] = new MySqlParameter("@name", MySqlDbType.VarChar, 20); parms[1].Value = sName;
            parms[2] = new MySqlParameter("@sort", MySqlDbType.Int32); parms[2].Value = iSort;
            parms[3] = new MySqlParameter("@id", MySqlDbType.Int32); parms[3].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteIBigClass(int id)
        {
            sql = "delete from face_m_website_i_bigclass where bigclassid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        public DataTable GetWebSiteISmallClassList(int communityId, int? bClassId, int? id)
        {
            sql = "select a.*,b.community_name,c.name as bigname,case when a.cansign=1 then '是' else '否' end as cansignname from face_m_website_i_smallclass a left join face_m_website_i_bigclass c on a.bigclassid=c.bigclassid left join face_m_community b on c.self_community_code=b.self_community_code  where c.self_community_code=" + communityId;
            if (bClassId != null && bClassId != 0)
                sql += " and a.bigclassid=" + bClassId;
            if (id != null && id != 0)
                sql += " and a.smallclassid=" + id;
            sql += " order by a.sort";
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteISmallClass(int id)
        {
            sql = "select a.*,b.community_name,b.self_community_code,c.name as bigname,case when a.cansign=1 then '是' else '否' end as cansignname from face_m_website_i_smallclass a left join face_m_website_i_bigclass c on a.bigclassid=c.bigclassid left join face_m_community b on c.self_community_code=b.self_community_code  where a.smallclassid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddWebSiteISmallClass(int bClassId, string sName, int iSort,int canSign)
        {
            sql = "insert into face_m_website_i_smallclass(bigclassid,name,sort,cansign) values(@bigclassid,@name,@sort,@cansign)";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@bigclassid", MySqlDbType.Int32); parms[0].Value = bClassId;
            parms[1] = new MySqlParameter("@name", MySqlDbType.VarChar, 20); parms[1].Value = sName;
            parms[2] = new MySqlParameter("@sort", MySqlDbType.Int32); parms[2].Value = iSort;
            parms[3] = new MySqlParameter("@cansign", MySqlDbType.Int16); parms[3].Value = canSign;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyWebSiteISmallClass(int id,int bClassId, string sName, int iSort, int canSign)
        {
            sql = "update face_m_website_i_smallclass set bigclassid=@bigclassid,name=@name,sort=@sort,cansign=@cansign where smallclassid=@id";
            MySqlParameter[] parms = new MySqlParameter[5];
            parms[0] = new MySqlParameter("@bigclassid", MySqlDbType.Int32); parms[0].Value = bClassId;
            parms[1] = new MySqlParameter("@name", MySqlDbType.VarChar, 20); parms[1].Value = sName;
            parms[2] = new MySqlParameter("@sort", MySqlDbType.Int32); parms[2].Value = iSort;
            parms[3] = new MySqlParameter("@cansign", MySqlDbType.Int16); parms[3].Value = canSign;
            parms[4] = new MySqlParameter("@id", MySqlDbType.Int32); parms[4].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteISmallClass(int id)
        {
            sql = "delete from face_m_website_i_smallclass where smallclassid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }


        public DataTable GetWebSiteIList(int communityId, int? bigClassId, int? smallClasId, int? id,int? recordNum)
        {
            sql = "select a.*,b.community_name,c.name as bigName,d.name as smallName,case when a.cansign=1 then '是' else '否' end as cansignname from face_m_website_i a left join face_m_website_i_bigclass c on a.bigclassid=c.bigclassid left join face_m_community b on c.self_community_code=b.self_community_code left join face_m_website_i_smallclass d on a.smallclassid=d.smallclassid where c.self_community_code=" + communityId;
            if (bigClassId != null && bigClassId != 0)
                sql += " and c.bigclassid=" + bigClassId;
            if (smallClasId != null && smallClasId != 0)
                sql += " and d.smallclassid=" + smallClasId;
            if (id != null && id != 0)
                sql += " and a.id=" + id;
            sql += " order by id desc";
            if (recordNum != null && recordNum != 0)
                sql += " limit 0," + recordNum;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteI(int id)
        {
            sql = "select a.*,b.community_name,b.self_community_code,c.name as bigName,d.name as smallName,case when a.cansign=1 then '是' else '否' end as cansignname from face_m_website_i a left join face_m_website_i_bigclass c on a.bigclassid=c.bigclassid left join face_m_community b on c.self_community_code=b.self_community_code left join face_m_website_i_smallclass d on a.smallclassid=d.smallclassid where a.id=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public int AddWebSiteI(int bigClassId, int smallClassId, string sTitle, string sContent,int iCanSign)
        {
            sql = "insert into face_m_website_i(bigclassid,smallclassid,title,content,cansign,createempid,createdate) values(@bigclassid,@smallclassid,@title,@content,@cansign,@createempid,now());select @@identity";
            MySqlParameter[] parms = new MySqlParameter[6];
            parms[0] = new MySqlParameter("@bigclassid", MySqlDbType.Int32); parms[0].Value = bigClassId;
            parms[1] = new MySqlParameter("@smallclassid", MySqlDbType.Int32); parms[1].Value = smallClassId;
            parms[2] = new MySqlParameter("@title", MySqlDbType.VarChar, 100); parms[2].Value = sTitle;
            parms[3] = new MySqlParameter("@content", MySqlDbType.LongText); parms[3].Value = sContent;
            parms[4] = new MySqlParameter("@cansign", MySqlDbType.Int16); parms[4].Value = iCanSign;
            parms[5] = new MySqlParameter("@createempid", MySqlDbType.Int32); parms[5].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            try
            {
                return Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, parms));
            }
            catch
            {
                return 0;
            }
        }

        public bool ModifyWebSiteI(int id,int bigClassId, int smallClassId, string sTitle, string sContent,int iCanSign)
        {
            sql = "update face_m_website_i set bigclassid=@bigclassid,smallclassid=@smallclassid,title=@title,content=@content,cansign=@cansign,createempid=@createempid where id=@id";
            MySqlParameter[] parms = new MySqlParameter[7];
            parms[0] = new MySqlParameter("@bigclassid", MySqlDbType.Int32); parms[0].Value = bigClassId;
            parms[1] = new MySqlParameter("@smallclassid", MySqlDbType.Int32); parms[1].Value = smallClassId;
            parms[2] = new MySqlParameter("@title", MySqlDbType.VarChar, 100); parms[2].Value = sTitle;
            parms[3] = new MySqlParameter("@content", MySqlDbType.LongText); parms[3].Value = sContent;
            parms[4] = new MySqlParameter("@cansign", MySqlDbType.Int16); parms[4].Value = iCanSign;
            parms[5] = new MySqlParameter("@createempid", MySqlDbType.Int32); parms[5].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            parms[6] = new MySqlParameter("@id", MySqlDbType.Int32); parms[6].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteI(int id)
        {
            sql = "delete from face_m_website_i_subitem where iid=" + id + ";delete from face_m_website_i where id=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }


        public DataTable GetWebSiteISubItemList(int Iid, int? id)
        {
            sql = "select * from face_m_website_i_subitem where iid=" + Iid;
            if (id != null && id != 0)
                sql += " and subitemid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public DataTable GetWebSiteISubItem(int id)
        {
            sql = "select * from face_m_website_i_subitem where subitemid=" + id;
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool AddWebSiteISubItem(int Iid, string sTitle, string sContent)
        {
            sql = "insert into face_m_website_i_subitem(iid,title,content,createempid,createdate) values(@iid,@title,@content,@createempid,now())";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@iid", MySqlDbType.Int32); parms[0].Value = Iid;
            parms[1] = new MySqlParameter("@title", MySqlDbType.VarChar, 500); parms[1].Value = sTitle;
            parms[2] = new MySqlParameter("@content", MySqlDbType.LongText); parms[2].Value = sContent;
            parms[3] = new MySqlParameter("@createempid", MySqlDbType.Int32); parms[3].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool ModifyWebSiteISubItem(int id, string sTitle, string sContent)
        {
            sql = "update face_m_website_i_subitem set title=@title,content=@content,createempid=@createempid where subitemid=@id";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@title", MySqlDbType.VarChar, 500); parms[0].Value = sTitle;
            parms[1] = new MySqlParameter("@content", MySqlDbType.LongText); parms[1].Value = sContent;
            parms[2] = new MySqlParameter("@createempid", MySqlDbType.Int32); parms[2].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            parms[3] = new MySqlParameter("@id", MySqlDbType.Int32); parms[3].Value = id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool DelWebSiteISubItem(int id)
        {
            sql = "delete from face_m_website_i_subitem where subitemid=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }

        public bool GetWebSiteIisSelfSign(int id)
        {
            sql = "select count(1) from face_m_website_i_sign where iid=" + id;
            return Convert.ToInt32(SqlHelper.MysqlHelper.ExecuteScalar(sCon, CommandType.Text, sql, null)) > 0;
        }

        public bool AddWebSiteISign(int iId, int? iSubId, string rem)
        {
            sql = "insert into face_m_website_i_sign(iid,isubid,empid,rem,createdate) values(@iid,@isubid,@empid,@rem,now())";
            MySqlParameter[] parms = new MySqlParameter[4];
            parms[0] = new MySqlParameter("@iid", MySqlDbType.Int32); parms[0].Value = iId;
            parms[1] = new MySqlParameter("@isubid", MySqlDbType.Int32); parms[1].Value = iSubId;
            parms[2] = new MySqlParameter("@empid", MySqlDbType.Int32); parms[2].Value = Convert.ToInt32(HttpContext.Current.Session["EmpId"]);
            parms[3] = new MySqlParameter("@rem", MySqlDbType.Text); parms[3].Value = rem;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql, parms) > 0;
            }
            catch
            {
                return false;
            }
        }
        #endregion

        #region 系统图标配制
        public DataTable GetSystemIcon(int communityId, string sMode)
        {
            switch (sMode)
            {
                case "1":
                    sql = "select id,name,iconurl,'face_m_website_chamber_icon' as tablename,'ygj' as cssname from face_m_website_chamber_icon where self_community_code=" + communityId;
                    break;
                case "2":
                    sql = "select bigclassid as id,name,iconurl,'face_m_website_i_bigclass' as tablename,'isq' as cssname from face_m_website_i_bigclass where self_community_code=" + communityId;
                    break;
                case "3":
                    sql = "select id,name,iconurl,'face_m_website_news_class' as tablename,'sjy' as cssname from face_m_website_news_class where self_community_code=" + communityId + " union all select introduceid as id,typename as name,iconurl,'face_m_website_com_introduce' as tablename,'sjy' as cssname from face_m_website_com_introduce where self_community_code=" + communityId;
                    break;
                case "4":
                    sql = "select govaccountid as id,username as name,iconurl,'face_m_gov_account' as tablename,'bbs' as cssname from face_m_gov_account where self_community_code=" + communityId;
                    break;
                default:
                    sql = "select id,name,iconurl,'face_m_website_chamber_icon' as tablename,'ygj' as cssname from face_m_website_chamber_icon where self_community_code=" + communityId;
                    sql += " union all select bigclassid as id,name,iconurl,'face_m_website_i_bigclass' as tablename,'isq' as cssname from face_m_website_i_bigclass where self_community_code=" + communityId;
                    sql += " union all select id,name,iconurl,'face_m_website_news_class' as tablename,'sjy' as cssname from face_m_website_news_class where self_community_code=" + communityId + " union all select introduceid as id,typename as name,iconurl,'face_m_website_com_introduce' as tablename,'sjy' as cssname from face_m_website_com_introduce where self_community_code=" + communityId;
                    sql += " union all select govaccountid as id,username as name,iconurl,'face_m_gov_account' as tablename,'bbs' as cssname from face_m_gov_account where self_community_code=" + communityId;
                    break;
            }
            return SqlHelper.MysqlHelper.Query(sql).Tables[0];
        }

        public bool ModifySystemIcon(string sTable, int id,string sIconUrl)
        {
            string sId = "id";
            switch (sTable)
            {
                case "face_m_website_i_bigclass":
                    sId = "bigclassid";
                    break;
                case "face_m_website_news_class":
                    sId = "id";
                    break;
                case "face_m_website_com_introduce":
                    sId = "introduceid";
                    break;
                case "face_m_gov_account":
                    sId = "govaccountid";
                    break;
                case "face_m_website_chamber_icon":
                    sId = "id";
                    break;
                default:
                    return false;
            }
            sql = "update " + sTable + " set iconurl='" + sIconUrl + "' where " + sId + "=" + id;
            try
            {
                return SqlHelper.MysqlHelper.ExecuteSql(sql) > 0;
            }
            catch
            {
                return false;
            }
        }
        #endregion

    }
}
